I think you’d be best off using a while loop. Add a set value that’s updated when done is true and use that as the basis of the ‘while’.
I found the while loop difficult to use with the ui, it works perfectly manually adding the code. You just can’t see the fields in the data pickers (I’ve not revisited since so it may have been updated).