App Inventor is single threaded... so everything runs in the UI thread...
see again The model of event processing in App Inventor by @Franklyn_A_Turbak
but you could try the following extension and run your loop in another thread...
Async Procedure Extension by Abhijith Dominic, source code by @ewpatton (MIT)
let us know, how this works for you...
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by
Taifun.