How to set and save a variable using the script