How to build a wooden ladder for a loft bed?
A nice ladder can be built similar to the following. Use 1x4 sized material and bore holes through it to accept closet pole for rungs. Select the angle of the vertical rails to suit your space and desired usage preferences. Rung spacing should be even - but not too close together. 

Ladder can be simply screwed through the side rail of the bed into the edge of the vertical ladder rail.