Need help converting imacros scripts

Good Afternoon. I have various imacros that I’ve used over the years to go through a couple of website I visit to get Free Amazon Books. The macros work even if the book costs as I don’t have a payment setup for my amazon account that I use for getting the books.

The scripts worked find with FireFox 56 and iMacros 9. But more and more of the web sites have been updated to block access from older versions of Firefox. So I’ve had to upgrade iMacros to version 10.x. But one of the downfalls is that alot of the scripts I had to change to sit in a loop as the newer version of imacros limits you on the number of lines in your script.

The following is one of the imacros I use…i’ve been trying to convert it but I keep getting tripped up. Can someone help? I looked but don’t see anything like the !LOOP varialbe in imacros. In context this variable would get populated when I would use the ‘Play macro repeatedly’ and some number.

For context, the first TAG would hit the indicated link based on the LOOP. So the first time through, the first link. The 5th loop would clck the 5th link.
This link would open the appropriate amazon kindle book URL.
The next 3 tags take care of the various versions of the book to purchase. For example if the book is available for pre-order. And there have been two different buy buttons.
And then finally close the tab.

VERSION BUILD=10101485
SET !TIMEOUT 10
'SET !TIMEOUT_STEP 1
SET !ERRORIGNORE YES
'URL GOTO=Kindle Ebooks Free | Daily Bargain Kindle Deals | Booksends
TAB T=1
TAG POS={{!LOOP}} TYPE=A ATTR=TXT:GETITONAMAZON
WAIT SECONDS=2
TAB T=2
WAIT SECONDS=1
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:buyOneClick ATTR=NAME:submit.preorder
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:buyOneClick ATTR=ID:one-click-button
TAG POS=1 TYPE=INPUT:IMAGE FORM=NAME:buyItem ATTR=SRC:https://images-na.ssl-images-amazon.com/images/G/01/digital/video/buttons/continue._CB485933821_.gif&&VALUE:buy.digitalfeed&&TYPE:image&&BORDER:0
WAIT SECONDS=2
TAB CLOSE

You can just use “play loop”

https://ui.vision/rpa/docs#loop

If you would prefer to avoid rewriting your macros you can try Pale Moon with iMacros 9. It’s what I use for some legacy stuff that I can’t transition over.