set local variable at for statement

In for statement, variables are global.
so, add declaration as local.