ATM Account Homework (Classes,Textfiles,Objects) : I am completely lost. Our homework assignment is to:
1. Create an ATM Program that asks a user for their name and pin
2. Program will loop through asking user if they want to check balance, withdraw, deposit, or exit. You exit the loop when user selects exit. The initial balance is $10,000
3. Create a text file that records all transactions. First 2 lines of the file should be the User's name and Pin
4. Create a class called which includes the __init__ and __str__ functions to display info from the user(deposit, check balance, withdraw)
5. Program needs to read from the file and create an object. The fields for the object are the name, pin, and balance.
6.If the pin number and the name they provide to not match the name and pin number for the BAcc object the program will end.  Otherwise you can proceeded to make as many transactions as you want updating the file
7.Errors must by handled using try: blocks!  This includes both invalid data entry and insufficient funds on a withdraw.

This is the code I have right now, it doesn't do much but I just need a way to connect it. 

    accountfile=open("ATMACC.txt", "a")
    name=input("What is your name? ")
    pin=input("What is your Pin #? ")
    accountfile.write("Name: " + name + "\n" + "PIN: " + pin + "\n")
    USER_BALANCE = 10000
    class BankAcc(object):
        def __init__(self,name,pin,balance):
            name = self.name
            pin = self.pin
            10000 = self.balance
        def __str__(self):
            return "Bank Account with Balance {}".format(self.name,self.balance)
        def checkbalance(self):
            print(self)
        def deposit(self,amount):
            self.amount += amount
        def withdraw(self,amount):
            if self.balance > amount:
                self.balance -= amount
            else:
                raise ValueError
    while True:
        answer=input("Would you like to deposit, withdraw, check balance, or exit? ")
        if answer=="deposit" or answer== "Deposit":
            x= input("How much would you like to deposit? ")
            USER_BALANCE += float(x)
            print ("Your new balance is: $" + str(USER_BALANCE))
            accountfile.write("\n" + "Deposit of $" + x + "." + " " + "Current balance is $" + str(USER_BALANCE))
            continue
        elif answer== "withdraw" or answer== "Withdraw":
            y= input("How much would you like to withdraw? ")
            if float (y)<=USER_BALANCE:
                USER_BALANCE -= float(y)
                print ("Your new balance is: $" + str(USER_BALANCE))
                accountfile.write("\n" + "Withdraw of $" + y + "." + " " + "Current balance is $" + str(USER_BALANCE))
                continue
            else:
                print ("Cannot be done. You have insufficient funds.")
        elif answer== "check balance" or answer== "Check Balance":
            print ("$" + str(USER_BALANCE))
        elif answer== "exit" or answer== "Exit":
            print ("Goodbye!")
            accountfile.close()
            break
        else:
            print ("I'm sorry, that is not an option")

Please help. I know this is a complete mess but any help would be greatly appreciated.