How do I get the below to loop until all emails are moved?

HTML Code: