Unlooping a loop whilst needing a loop

Logic blindness, early night tonight. thanks JuraJ how obvious. Silly me!