If you mean to save data across executions, everything in memory of the "live" program gets discarded at the end of execution, so you must save data to a file (or some other persistent medium), then read it back in.
You can save to a file as simple strings, or you can use pickle to easily serialize objects like lists.
Using simple strings
Wrap your program with code to load and save data to a file:
data=[]
try:
old_data= open("save_data", "r").read().split('\n')
data.extend(old_data)
except:
print ("Unable to load old data!")
data = ['data1', 'data2', 'data3 ' , 'data4', 'data5' ]
#YOUR PROGRAM HERE
try:
with open("save_data", "w") as out:
out.write('\n'.join(data))
except:
print ("Unable to write data!")
Of course, you have to do some work to prevent having duplicates in data if they must not appear.
Using pickle
import pickle
data_fn = "save_data"
data=[]
try:
with open(data_fn, "rb") as data_in:
old_data = pickle.load(data_in)
data.extend(old_data)
except:
print ("Unable to load last data")
data = ['data1', 'data2', 'data3 ' , 'data4', 'data5' ]
#REST OF YOUR PROGRAM
try:
with open(data_fn, "w") as data_out:
pickle.dump(data, data_out)
except:
print ("Unable to save data")
pickleorjsonmight be even simpler, just because you can read and write the whole file with a single linepickle.dumps(data, datafile). No need to worry about remembering to add/remove newlines, whether or not to quote things, etc.