Method 1:
Use default prefs system
Any global var prefixed with $Pref:: will be saved to config/client/prefs.cs (unless you then add Server:: to it, which will be saved to the server folder)
Simply rename your global var to $Pref::var and it will be saved.
Method 2:
Export it yourself
Use this line of code
export("$var", "config/client/nameofmyaddon/prefs.cs");
and it will be saved to that file. Saving other stuff to this file will overwrite it, so if you want to save multiple global vars, do something like this:
export("$MyAddonPrefs::*", "config/client/nameofmyaddon/prefs.cs");
And use $MyAddonPrefs:: as a prefix. In that case,
$MyAddonPrefs::CoolVar1
$MyAddonPrefs::MyName
$MyAddonPrefs::ThCIAAPref
would all be saved to that file.
You would then execute that file as if it was a code file, to load the saved values.
exec("config/client/nameofmyaddon/prefs.cs");