After you cut and assemble the shelf, twist it between the existing ladder steps as shown. (This may be a tight fit and require a little bit of effort.)
Once you have the shelf in place, drill 3/8" holes into the loft bed legs.
Use the holes in the shelf as a guide.
Attach the shelf to the bed using 3/8" x 3-1/2" Long Bolts, washers, lockwashers, and wingnuts. Notice that the shelf leaves enough space above the step for you to still use the ladder.
Your book shelf is now ready to use!