I wanted to know if there was a reccomended solution to storing temporary files.
If you are writing Applescript then do it the Applescript way. Applescript created a language construct for creating temporary files, so use it.
set temp to path to temporary items
The user of ~/Library/Caches/TemporaryItems/ means your temporary files will not interfere with other users, which is not the case for the standard Unix temporary directories. Then again, when Unix was created you measured disk sizes in megabytes (maybe even kilobytes). And since many systems had disk quotas, the shared temporary directoies allowed users places to create large scratch files in order to get a job done, but since the temporary directoies got deleted frequently it was not someplace they could store date long term. But today with gigabyte and terabyte storage available having a personal temporary directory is not as much of an issue.
It doesn't make sense that there would be four locations which are meant to function identically.
Of course it makes sense. You are dealing with history, and trying to support different applications written across 40+ years, different programming languages, different scripting languages, etc... All of which were either written when the perferred temp location was different, so if you want the apps to run on your Unix, the system needs to support temp directories are different locations.
/tmp is original Unix temporary file location. But /tmp was on the boot drive, so eventually Unix implementations started to have /usr/tmp, as often /usr was on a different physical disk drive with more space. Eventually someone came up with /var and so Unix distributions started having a /var/tmp.
/private is a Mac OS X construct where Mac OS X stuff a lot of Unix standard directories that are private to the Mac OS X Unix implementation and the use of /private was intented to imply users should not mess with these files. So Mac OS X created a symbolic link that points to /private/tmp. /var is a symlink to /private/var, hence /var/tmp is really /private/var/tmp. You need to symlinks as traditional Unix apps will expect to find them via that path.
TMPDIR was a Unix environment variable created so that apps could find the preferred place to store temp files on the Unix platform they were running on, as not all places Unix was running had sufficient disk space for temp file in /tmp, or the user may want their app to store temp files somewhere else.
So if you are writing a Unix application that needs to run on any Unix system, then use mktemp or any of the family of Unix utilities and or functions that will make sure you are using the desired temp directory on your system, as well as making sure your temporary file name is unique and does not conflict with other users and applications.
But since you are using Applescript use the Applescript temporary file directory.