making permanent changes to sketch via serial bluetooth

Hello,
Im trying to make permanent changes to my arduino sketch via bluetooth (serial input to arduino). I want to make it so that if a variable gets updated by the bluetooth the arduino saves that and won't reset the variable when it restarts, basically saving personal preferences after shutdown....

I've read a few of the serial communications forums like this one:
Serial Input Basics - Programming Questions - Arduino Forum,
and an article here:
4. Serial Communications - Arduino Cookbook [Book].

but none of them seem to do what I would like(they all seem to just change the sketch for the amount of time the sketch is running for and would reset after reboot. If anyone can point me in the right direction it would be much appreciated.

One option I've been toying with is making a file in a connected SD card and saving changes to the and then when arduino restarts drawing the variables from that file?

any help would be appreciated, thanks

If anyone can point me in the right direction it would be much appreciated.

The code, including variable initialization, lives in read-only memory, so you can't make permanent changes while the program is running.

What you can do is save the values that are interesting to EEPROM, and read the contents of EEPROM in setup() to get the initial values for the relevant variables.