Where global variables are stored?

 

You can do it manually from the Global Variables window . . press F3

Also . . . just Googled out of interest . . . https://www.mql5.com/en/forum/126287

It's in TerminalPath()+"\profiles\gvariables.dat"