The mktemp command in Linux creates temporary files and directories with unique, unpredictable names, which is the safest way to handle scratch data inside shell scripts and system tasks.
Most shell scripts you will read online create temporary files with something like /tmp/mydata.txt or /tmp/backup-$$.log, which works until two copies of the script run at the same time, or until a malicious user guesses the filename and drops a symlink in /tmp pointing to /etc/passwd. Suddenly, your harmless script is overwriting system files, and you have a real problem on your hands.