from datetime import datetime
import time
while True:
     with open('time.txt','a') as file:
        current_time = '{date}'.format(date=datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
        file.write('{date}\n'.format(date=current_time))
        print(current_time)
     time.sleep(60)