You have defined that variable inside of a pair of {}s. The {}s define the scope or definitional visibility of the variable. The variable is not defined outside of the {}s.
You need to move the...