How to create and save a text file only with TextEdit

Hi! Actually I’m learning the AppleScript and I want to know, how is it possible to make and save a text file only with TextEdit. Viewing the Dictionary, it could be very easy, but, I receive an errores, for example : AppleScript Internal error.
Could somebody help me? Thanks!


set Filename to "TestFile"--Name the file 

set this_data to "The quick brown fox jumped over the lazy dog" as string--Any text here
set target_file to "Disk:Users:Path:Desktop:" & Filename--You can eliminate "Filename" as a variable and type the filename as part of the path (if you wish) but you need a full path 
set append_data to true--Set this to false if you want to overwrite, true if you want to add text to an existing file

try--This part writes the file
	set the target_file to the target_file as text
	set the open_target_file to open for access file target_file with write permission
	if append_data is false then set eof of the open_target_file to 0
	write this_data to the open_target_file starting at eof
	close access the open_target_file
on error
	try
		close access file target_file
	end try
end try

--This is optional to set the font
tell application "Finder" to open target_file--

tell application "TextEdit"
	tell paragraphs of the text of the front document
		set the font to "Arial"
		set the size to 16
	end tell
end tell

SC

This last part is perhaps more easily done as:

tell application "TextEdit"
	open target_file as alias
	tell paragraphs of the text of the front document
		set the font to "Arial"
		set the size to 16
	end tell
end tell