How do I do looping on playbook?

Try:

with_sequence: start=1 end=1000

Search the docs for with_sequence.