EOF
#for print text in end file
cat <<EOF>> yourfile.txt
your text ....
EOF
#for print text and remove past txt
cat <<EOF>> yourfile.txt
your txt ....
EOF
#creat or cope text for end file ..use sudo
sudo bash -c 'cat << EOF >> yourfile.txt
line1
line2
line3
EOF'