Use a variable in a „Prompt for user input“ for the number of loops in a "Repeat Macro"

Now that you know how to use KM Repeat loops, you can create a "template", maybe like my above Macro, and save multiple Actions as one "Favorite Action" using @DanThomas' great KMFAM system:
MACRO: [KMFAM] Favorite Actions and Macros

Then, whenever you need your custom Repeat template, just press F12, type "repeat", and press RETURN. Your Repeat template is inserted into your current Macro, at the current location.

I use this system many times a day, and it makes building KM macros a breeze. Let us know if you have any questions about this.