Loop over a tag by i+1

I want to download multiple items which have different a tags. For example:
First is: [a]
Second is: [a2]
Third is: [a3] and so on…
I wondered if there is a way to increase a by one such as [a+1] for each loop.

For how to increment a variable (add 1) see here:

I have read it but I have no idea where to paste that code and how can it interact with my a or div tag.