Each line in command line is executed as one scope, so if you define local variable in one scope it is not visible in another.
When you set verbose=yes, each line is processed as separate console line.
So either you define global variable instead of local or put the script in {} which will render verbose thing useless, because everything in {} will be executed as a single scope.