i'm trying to create a program in python that will take a status of a server from webpage and saves it into txt document. The problem is that everytime I run the program, the variable changes, so it should write each information on a new line. However it keeps running on the same line and only changing the previous text to new one. Thanks for every response.
from selenium import webdriver
#Creates a txt document to write to
txt = open("amx_log.txt", "w")
#Takes data and puts it into a variable
path = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(path)
driver.get("https://exampleweb.com")
serc = driver.page_source
main = driver.find_element_by_xpath("/html/body/div[1]/div[2]/div[2]/div/center[2]/table/tbody/tr[54]")
main1 = main.text
#Takes the data and writes it into txt document
txt.write(main1)
txt.write("\n")
txt.close()
driver.quit()