If you’re looking for a pure Python solution, then the code below will simply write the values to a text file, until it catches a control-c, at which point it will close the file and exit. You could add something like
time.strftime("%d%m%%y-%H%M%S", time.localtime()) if you want to timestamp the values.
If you want a quick and dirty solution with the code you already have, then you can just save your code as
foo.py, then in the terminal do
./foo.py > output.txt. That will pipe the output of your program (the readings) to a text file and it should exit when you press control-c also.
f = open("output.txt", "w")
value = automationhat.analog.one.read()
f.write(str(value) + "\n")