Having raised 4 boys, and a few bunk beds along the way, the crude little sketch attached is how I would go about constructing the beds.
All the beds we used were 2x6 or 2x8 boards (pine). Rather than use the 2x4 uprights in your drawing, and adding another 2x4 at each corner to give you the "L" shape, I would go with 2x8 for optimum safety and support. The upright supports should go at the end of the bed, not on the side. Secondly, you definitely need to add two cross braces at each end. I've shone the upper brace only in my quick sketch.
The uprights can use some long connector type bolts, or lag screws/bolts. This to allow disassembly and getting to the room in pieces. The cross braces can be mounted using wood screws. The brace needs to be kinda mid-third of the way down to provide the structure support needed.
Unless you have a high ceiling, the steps up....once half way up, you will need to start bending over so as not to hit the ceiling with your head. I would suggest a ladder at the bottom end, or at the side towards the bottom vertical support. This would also allow each bed, if you wanted to add it, a sort of recessed headboard area to sit books, glasses (reading or water) and other miscellaneous stuff.
Just my thoughts....adapt if you see any benefits.....