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>>
writetofile()
<< execute some commands>>
writetofile()

on writetofile()
try
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.

http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.11.htm

– Rob