Setting custom data for iTunes track via the command line

I have an Applescript that manipulates the data on a track. The meat of it consists of a couple of tell blocks:

              tell application id ""
			set newTVShow to (add (encodedFilePath as POSIX file))
			tell newTVShow
				set name to episodeName
				set album to seriesName
				set album artist to seriesName & ", " & seasonNum
				set artist to seriesName
				--set comment to "Added by automated process"
				set episode ID to seasonNum & episodeNum
				set episode number to episodeNum
				set season number to seasonNum
				set show to seriesName
				set track number to episodeNum
				set video kind to TV show
			end tell
			set trackTime to the time of newTVShow
		end tell

All the variables are set before this block executes.
What I would like to be able to do is to run this from the terminal using osascript, one line at a time. I can add the file to iTunes no problem, I am stuck trying to reference the new track and set it’s properties. I don’t want to just call a script from the command line because I’d have to pass in a ton of variables .

I figured out the syntax, it was not that hard, don’t know why I had trouble -

osascript -l AppleScript -e 'tell application "iTunes" to set name of track id 1239630 to "New Track Name"'

The track id is returned when I add a track, and I just use that in all the subsequent statements which I execute one at a time.