Trying to make the user write to a file and seeing if it exists and if they should override it

    print("Enter a file name to save your database to.")
    name = input('Enter name of text file: ')+'.txt'
    if name print ("Would you like to overwrite this file? Yes or No")
    if "yes"

What language are you using? What code have you tried?

You can start with this

import os

print('Enter a file name to save your database to.')
name = input('Enter name of text file: ').strip()
if name:
    name = os.path.expanduser(name + '.txt')
    if os.path.isfile(name):
        while True:
            overwrite = input("Would you like to overwrite this file? Yes or No: ")
            overwrite = overwrite.strip().capitalize()
            if overwrite in ('Yes', 'No'):
                break
            else:
                print('Error: please answer Yes or No')
        if overwrite == 'No':
            raise NotImplementedError("I don't know what to do!")
else:
    raise RuntimeError('Got an empty name')