I'm not sure what you're wanting. It seems that you run a script and test whether the environment variable is set after the script runs. This will not work - the envrionment variable has been set in a subshell.
Check out the source command or . (period) to execute commands which are contained within a script in the current shell.