appending text using a text file

I am opening a text file and on a number of occasions during my script I want to append new data to the text file… I am using the code below but it is not working…It doesn’t understand append… what should i be using??

set LogName to open for access “TextFile.txt” with write permission
<< executing some commands>>
<< execute some commands>>

on writetofile()
open for access LogName with write permission
append this data to LogName
close access LogName
end try
end writetofile

I suggest that you take a look at the write handler provided by Apple.

– Rob