The code checks if the file exists I am struggling to complete this and save my database (gen0values) and make it open to a file in a table.

def exportdata():

    print("\nYou chose option 4")
    import os
    filename = input("Please type in the filename")
    if os.path.isfile(filename):
        print("File exists")
    else:
        print("File does not exist")

What kind of data does the database contain ? Do you know how you want the data to appear in the file ?

Depending on your data, there are several ways to do this. A simple one is to write a csv file using the csv module. See https://pymotw.com/3/csv/ for explanations. A csv file can be opened with any office suite such as LibreOffice.