from tkinter import *

root=Tk()

files=['bill1','bill2']
btn=[]
content=StringVar()
"""for i in range(3):
    files.append("Button"+str(i))"""

def clear_entry():
    tYpe.delete(0,'end')

def addTofiles():
    cOntent=content.get()
    files.append(cOntent)
    clear_entry()


for i in range(len(files)):
    btn.append(Button(root,text=files[i],
        command=lambda c=i: print(btn[c].cget("text"))))
    btn[i].pack()

tYpe=Entry(root,textvariable=content)
tYpe.pack()
filebtn=Button(root,text='add',command=addTofiles)
filebtn.pack()
menubar=Menu(root)
optionsmenu=Menu(root,tearoff=0)
optionsmenu.add_command(label='exit',command=root.quit)
menubar.add_cascade(label='options',menu=optionsmenu)
root.config(menu=menubar)
root.mainloop()