can someone help me make this script?

I need a script that will read the first email I have in the mail app and then put the subject into a text file

Try this.


--Choose the message in Mail first
tell application "Mail"
	set msg to item 1 of (get selection)
	set theSubj to subject of msg
end tell

tell application "TextEdit"
	make new document at front with properties {text:theSubj as Unicode text}
end tell

I am incredibly grateful thank you soo much!