I use for each UI element and activity to start a download is clicking the current element.
The problem is that sometimes the automation downloads the same file 2 or 3 times (it downloads all of them but sometimes the issue is that it downloads one file twice and that is not needed.
The image you have shared has two for each loops
so delete the repeat number of times activity and drag the if condition in that activity to the for each ui elements activity.
I found the error it was something else I fixed it by adding check app state before the for EACH UI ELEMENT
What was wrong:
When I clicked a button then the elements for “for each UI element” appeared on the screen and the automation started downloading them but then for some reason the subpage was refreshing in the middle hence it came back to download them again