how to create a loop so that he clicks

Hello everyone, I’m new to the topic, so please forgive the layman’s question, I’m trying to create a macro to make him click on the links one by one on the page,
this is the constant xpath=//div[17]/div/div/div/span,
I only change the number in brackets and clicks on subsequent links,
how to create a loop so that he clicks on up to 100 links in turn, for example

Hello

try this code.
The Repeat Loop is 100 and the value inside the Xpath will start at 1 and will go up one by one.

{
  "Name": "CLICK",
  "CreationDate": "2025-1-23",
  "Commands": [
    {
      "Command": "store",
      "Target": "1",
      "Value": "index",
      "Description": ""
    },
    {
      "Command": "while",
      "Target": "${index} <= 100",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "xpath=//div[${index}]/div/div/div/span';",
      "Value": "dynamicXPath",
      "Description": ""
    },
    {
      "Command": "click",
      "Target": "${dynamicXPath}",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "executeScript",
      "Target": "return Number(${index}) + 1;",
      "Value": "index",
      "Description": ""
    },
    {
      "Command": "endWhile",
      "Target": "",
      "Value": "",
      "Description": ""
    }
  ]
}

Thank you very much, unfortunately when I run it it shows me this error
[error]
Line 3: Unexpected token

The code had a small error, change this part and I believe it will work.

{
      "Command": "executeScript_Sandbox",
      "Target": "//div[${index}]/div/div/div/span",
      "Value": "dynamicXPath",
      "Description": ""
    },