## You can use 'mktemp'
## Storing filename in a variable
## The X is replaced by random string
tmpfile=$(mktemp /tmp/abc-script.XXXXXX)
temp_file=$(mktemp)
# do something with the file
rm ${temp_file}
# The next line will create a temporary file and return its path.
path="$(mktemp)"
echo "Hello, World!" > "$path"