You are redefining this variable every loop. You should move the declaration outside of this loop.