Converting a twin bed into a loft is really just a matter of extending the posts of the bed frame and making sure the resulting structure is stable enough to hold up the sleeping occupant. These instructions are for converting a wooden frame bed with actual foot posts, but the idea can be customised for other kinds of bed.
Measure the width and height of the bed posts of the twin bunk.
Buy your posts using lumber with end dimensions as close as possible to the dimensions of the bed posts. If you can't get an exact match, use the next largest size.
Buy strips 4 inches wider than the combined width of the bed posts and two of the posts you just bought. For example, if your bed posts were 2 inches wide and your lumber posts were each 1 1/2 inches wide, your strips would each be (2+1 1/2+1 1/2 +4=) 9 inches wide.
Have the hardware store cut your strips to size if necessary. They have equipment that can make a straight cut much more reliably than any home shop.
Cut your beams so that the total length of the beams, plus four posts, plus two bedposts equals 38 inches. Using the example above, your beams would need to be (38-11-11=)16 inches long. Note you can often get more than one viable beam out of a single piece of lumber.
Lay one post flush against one edge of one strip and screw it in place with a screw at each corner and two evenly spaced along the edge.
Lay a second post parallel to the first post, with enough space in between to fit the bed post of your twin bed. This should leave about 4 inches of strip extending beyond the edge of your post. Screw it in place as you did the first post.
Lay a second strip opposite the original strip and screw it in place on both posts using a total of eight wood screws.
Repeat steps 3 and 4 to build a total of four end pieces.
Connect two end pieces using a 2 by 4 beam. Insert the beam into the notch formed by the strips. Align the beam so it is flush with the ends of both end pieces. Screw it in place with four screws in a square at each point of connection.
Attach a second beam to the opposite end of the end pieces using the same steps.
Repeat steps 5 and 6 to assemble a second end frame.
Move all components to the bedroom where the loft bed will stay. This is much easier than moving the fully assembled bed.
Lie the bed frame on its side and slide the end frames in over the ends of the bed posts.
Screw the bed posts in place using two wood screws per post. Drill through the plank on the interior side of the end frame.
Turn and lift the bed so it rests on its end frames.
Connect the two end frames using one of the long planks. Lay the plank so that it runs flush with the tops of the end frames. Screw it in place with four screws, arranged in a square, at each point of connection.
Add a second plank, running parallel to the first, 24 inches from the floor. Attach it as you did the first, with a total of eight screws.