What happened to the TMP environment variable?
A good way to create a temporary directory is using mktemp, e.g.
mktemp -d -t
This way, you can even make sure, that your file names won't collide with existing files.
You are probably thinking of TMPDIR
.
This variable shall represent a pathname of a directory made available for programs that need a place to create temporary files.