Macros don’t do looping or branching. Macros are just a list of commands that run from the start of the list to the end of the list.
For more complex programming (including looping, branching and conditionals) you need to use a programming language such as Nyquist (built into Audacity) or an external language such as Python.
See: Nyquist - Audacity Manual
and: Scripting - Audacity Manual
The easiest way is:
Double click on the first clip
“Ctrl +B” then “Enter” (labels the first clip)