There are a couple ways you could draw the borders:
- Use either two vertex buffers or a single buffer and two draw calls with appropriate starting indexes to draw the border vertices as a LineStrip.
- Use a single vertex buffer containing all the vertices, create an index buffer to draw the vertices in pairs and render as a LineList.
For the intersections, you'll want to look into line-box intersection tests. Off the top of my head, I would say you could treat the inner edges of the border as a set of planes, intersect the box with each plane, and then check that the intersection point lies on the segment of the plane that is part of the barrier.
To make the cube wrap top-to-bottom as you are describing, you will probably need to draw it twice, once with the center offset just off the top of the screen and once with the center just below the bottom of the screen. Unrelated to the rendering, you will probably want to simply wrap the cube center to the bounds of the sceen, so that if it goes off the bottom, it is logically positioned at the top of the world, even though you may need to draw it in both places for a few frames.
I don't know about your last question, but you could probably write some simple code that could read in something like an ASCII art representation of your level and generate the necessary vertices.