File permission error

I’ve prepared a stripped down version of a longish script to show the problem - this runs under OS9, but gives a file permission error in OSX. All my scripting so far has been OS9, and I usually grab bits from earlier scripts without much understanding! I suspect something has changed, and I should probably stick the words ‘as alias’ in somewhere…

Here’s the script (which just writes a few words to a file):

set FileList to {“one”, “two”, “three”}
copy (choose file name) as string to dataFile
open for access file (dataFile) with write permission

tell application “Finder”
repeat with theFile in FileList
write (theFile) & return to file (dataFile) starting at eof
end repeat
end tell

close access file (dataFile)

Works in OS9. Fails in OSX. Suggestions? - TIA!

Don’t ask the Finder to do the writing.

This works for me - 10.3.4

set FileList to {"one", "two", "three"} 
copy (choose file name) as string to dataFile 
open for access file (dataFile) with write permission 

repeat with theFile in FileList 
write (theFile) & return to file (dataFile) starting at eof 
end repeat 

close access file (dataFile) 

Best,

Yes! That’s it! Now it runs in about 2 minutes on OSX (as opposed to up to 15 on OS9)! My boss is going to be so impressed.

Thanks a million!
Emma