Thanks for the update.
The number of images can vary depending on the user (i.e. there could be 1 image or 3 images), however, if there were 3 images I was hoping to add them all in the same place in the document which I currently have a placeholder as $IMAGE$.
The code you previously provided would require me to have multiple placeholders 'VAR' and ' NEWVAR', however as I don't always know the number of images for each time the script is executed.
Is there away I could replace $IMAGE$ with multiple images?