Take into consideration the room where you will be building the bed. You will probably want to allow about three feet of space between the bed and the ceiling. Any tighter and you may find it uncomfortable to get in and out of bed. If the ceiling is lower than 8 feet, you may wish to reconsider building a desk/loft bed in this room. You might consider a lower variation with drawers beneath the bed, and place the desk elsewhere. If the ceiling is at least 8 feet, you can count on plenty of headroom above the bed.
Measure out a generous space of about 80 by 40 inches where you'll put the bed. Be sure no windows or doors interfere with this space. (You may actually want to have a window above or below the bed; however, in that case, be certain it will align to your liking.)
Check that the mattress you are using is a twin, which measures approximately 38 x 76 inches. While it is certainly possible to build a loft for mattresses of different sizes, you will need to adjust the directions accordingly.
Double-check the lengths of all lumber and the number of screws and bolts. Continue to "measure twice and cut once" throughout the project.
Cut the 2x6 boards to form the sides of the "box" your mattress will lay upon. Cut two boards to measure 78 inches and two more to measure 37 inches.
Assemble the four sides of the box. Let the long pieces overlap with the shorter ones so that your box measures 40x78 inches. Attach the four 2x6 boards at their corners using 12 3-inch drywall screws.
Lay the plywood atop the box. Be certain that it fits snugly. Use twelve 1-5/8 inch drywall screws to affix the plywood to the box. Space them evenly around the perimeter.
Measure 44 inches along the length of each of the 4x4 posts. Laying all four posts together and marking them once will ensure that they are even. This line represents where the bed box will intersect with the vertical 4x4 posts.
Line up the 2x6 boards and the 4x4 posts according to the line you have already drawn. Drill 1/4-inch holes through the 2x6 boards and two inches into the 4x4 posts. Use the lag bolts to connect the pieces.
Decide whether you will buy a desk or build your own. Check second-hand resources to find an economical option that fits beneath your DIY loft.
Use the same principles of construction if you decide to build a smaller desk, always measuring twice and cutting once. Consult online plans to design a desk with the right dimensions for your loft.
Finish your bed and desk with a matching varnish. If you have purchased the desk in a finished wood, sand it before applying the varnish to achieve a matching effect.