I was wondering what your desired function is, as you say you are not having 'good' control without the for loop? What you are currently telling the PID function, by using the for loop, is "I have actually sampled many times (n size of for loop) in this second, and they were all the same" which is kind of bypassing the PID functionality, and not accurate.
Is your problem that it is not reacting fast enough, or not getting close enough to the target? In that case, what you need to do is tune your PID loop coefficients - details on how to do this are in the PID Control Toolset user Manual, section 2-6. I have always found tuning to be almost an art form, and experience really serves - especially when the control output is an on/off vs. a proportional output. Which is yours?