Image in for loop not showing

Thanks for your help. if it’s only drawn on the canvas after draw() is finished I think I know a solution. Will use your advice too. What I plan to do is to

Run a function in draw. In that function run the for loop
After checking the file exists set variable a to i and variable b to j and Boolean c to true.
While c is true stop the function

If draw check if c is true
If true load image b/a.png
Wait for key input
Set c to false

You reckon this will work?