The concept you are possibly looking for is Nested Loops
] i.e. you want an outer loop for 2 iterations.
As @f-es-sitecore says, a for-loop is better when you know up front how many times you want to do the loop.
I personally would probably do something like - pseudo code here only
Note that you have already done the "without spaces" bit properly - but it does need to be inside the loop not outside it