Help with a nested loop

Hi all,
I hope you are all well,
I have a issue when I try to make a nested loop in my program. Please have a look to next figure.


I have a algorithm to calculate a kind of small rectangles on the surface following a Reference curve path.
This code is inside of a loop 01 and with that I can generate a column of these small rectangles. Then, I would liked to repeat this procedure using another loop 02, but I couldn’t do it.
I would be very grateful if someone of you can help me.
CTS control width.gh (47.7 KB)
In my program, I copy and paste the code twice, but I would like to use a nested loop.
Thank you very much for your time!
Edwin Rosario