Using the append mode to create a program that appends a line of text to a file each time it's run:
f = File.new("logfile.txt", "a") f.puts Time.now f.close