Shell Scripting - How to append output to the end of text file

#!/usr/bin/bash

echo -e "Enter name of th file:\c"

read file_name

if [ -f $file_name ]

then

if [ -w $file_name ]

then

echo "Type some test data. To quit press ctrl+d."

cat>> $file_name

else

echo "The file do not have write permission"

fi

else

echo "$file_name not exists"

fi