Taking dialog box data and inserting it into a text file

I trying to make a script that will take a value for username and insert that text into user.txt I get shell script error “some parameters missing for do shell script” I’m also not sure if I am doing this correctly. thanks

set this_folder to “Pocket20GB:Text:”
set the thefilename to “user.txt”
set thefullpath to POSIX path of this_folder & thefilename

set the_user to text returned of (display dialog ¬
“Please enter username:” default answer “enter username here”)

do shell script "echo & the_user & " > " & thefullpath & "

I think you can just say

do shell script "echo" & the_user & " > " & thefullpath

since “echo” is a string (and the_user is a variable set to a string), thefullpath is coerced to a string as well, so you don’t need to enclose the do shell script parameter in quotes.