Export variable into .txt

would it be possible to save/export a variable using a button into a .txt file?

i know you can load a variable from a txt file, but i want to do the opposite :confused: