This question, or one strikingly similar has been posted here in the past. I assume its an exercise for a PLC programming class, although probably not for the HNC exam in Great Britain.
You have to create a sequence of 16 steps. Having a cylinder reach it's appropriate end-of-travel switch will be the event that triggers the transition from from one step to the next. Use a counter to keep track of the number of times you've gone through the repeatable section. At the conclusion of step 14, if the count is less than 5, the next step after 14 will be step 1. If the counter is at 5, the next step after 14 will be step 15. Reset the counter in step 15 or 16.
Some brands of PLC have functions that can reduce the amount of ladder logic required to program a sequence like this.
This is an excellent example of a system that could benefit from being programmed in SFC (Sequential Function Chart) instead of RLL (Relay Ladder Logic).
Start by programming a sequence that controls extending a piston until it reaches it's "Extended" limit switch, then retracting until it reaches it's "Retracted" limit switch, and then repeating the cycle. Once you have a program that works, it should be easy to expand your logic to handle a longer sequence.
Your program should also include some logic to reset the system to it's rest state in the event of an abnormal or aborted sequence.