Stepper and g code

How can I make a loop on g-code ?

That question does not make sense.

You might want to create a loop that reads g-code one line at a time. But that is not looping g-code.