'Trying to output User input to a txt file from my Bash Script [duplicate]

I'm pretty new to the world of Shell Scripting but, I Have put together this simple Bash Script that will take in a users account registration information and I need to output it to a text file that I will be using later on. I have tried various approaches but cant seem to get it too work any assistance on this matter would be greatly appreciated.

Here is the Code I have Written thus far

#!/bin/bash

clear

echo "Welcome, This Is The Registration Form Associated With Option 1"

echo "--------------------------------------------"
echo "Please enter In the Requsted Details Below"
echo -e "-------------------------------------------- \n"

#Taking in the users Registration Information
echo "Please Enter Your Full name (Forename and Surname): "
read AccountName
echo "Please Enter Your Date of Birth in the format (DD/MM/YYY): "
read DOB
echo "Please Enter The Username You Would Like To Have While Using The System: "
read Username
echo "Please Enter The Password You Want To Associate With This Account: "
read -s Password
echo "Please Enter The Email Address You Want To Associate With This Account: "
read Email

#Redirecting The Users Account Registration Information to a text file called Register.txt

# Output infromation above to a text file?? 


Solution 1:[1]

Just redirect output to a file:

#!/bin/bash

...
# Redirect all further output to Register.txt
exec >> Register.txt  # This will append to the file: probably you want
                      # additional logic to handle existing records

printf "Accountname: %s\n" "$AccountName"
printf "DOB: %s\n" "$DOB"
...

Solution 2:[2]

You could redirect stdout to a file with >:

printf "%s\n" "$AccountName" "$DOB" "$Username" "$Password" "$Email" > Register.txt

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 William Pursell
Solution 2 Cole Tierney