Your sentence is almost correct but could be improved slightly for better clarity and grammar. Here is the corrected version:
Original: When the sun is up, the desert sand gets very hot. Once the sun sets, it quickly loses all that heat.
Corrected: When the sun is up, the desert sand gets very hot. Once the sun sets, it quickly loses all of that heat.
Explanation: Adding the word "of" in "all of that heat" makes the sentence sound more natural and grammatically complete.