Shell Script (Bash) write to Text-File question

Thank you for your fast reply!
If I put that into the script, the whole text is doubled and added to the file… can I avoid that?