This variable don't exist. You this variable declaration and the others used in the loop should go in the new function that you should create.