Please help me fix these for..loop

I updated this question below. Please help if you know this.

Thanks!