The thing you need to be aware of with “it” is that there is only one “it” in any context (frame). So if you have nested repeats that are putting their value into “it”, the inner loop is overwriting the value that the outer loop is putting into “it”. You’ll need to have one of the loops put its iterator value into another variable – this will tend to be more readable and easier to debug anyway. There are two syntaxes for doing this:
repeat with myVar=each item of someList...
repeat with each myVar of someList...
Then within the loop you’ll just refer to myVar where you’re currently referencing “it”.
If you call a handler within a repeat loop, the handler can write to “it” without affecting the “it” in the repeat loop, because the handler has its own context and thus its own “it” variable.
Hope this helps.