ATP is responsible for cocking (pulling back) the myosin head, ready for another cycle. When it binds to the myosin head, it causes the cross bridge between actin and myosin to detach.
ATP then provides the energy to pull the myosin back, by hydrolysing to ADP + Pi.