Yes Staying up all night even just once is bad for your health so you should not stay up all night unless you cannot sleep.
If you do stay up all night once then you need to sleep the next day to catch up on your sleep because being sleep deprived can lead to serious health problems including heart disease and can actually lead to a heart attack.
People who stay up all night too often can actually have a shorter lifespan due to the health problems that arise from staying up all night.
There have been some nights where I had to stay up all night for emergencies such as taking a child to the hospital overnight.
But I sleep the next day and try to catch some sleep in the hospital waiting room if I can.
Staying up all night though should be avoided unless you're working night shift on a job and sleep during the day and then work during the night.