Sometimes it's okay to fudge the numbers to benefit your players. If you have to, pull something weird including having the monsters retreat due to something happening elsewhere or whatever. You can totally just make stuff up to preserve the party and advance the story if needed.
Having enemies retreat is the opposite of fudging, it is having monsters react to the world around them instead of being bags of hit points that always fight to the death. Fudging is ignoring the random chance rolls.
Totally, even if the reason to retreat might not have existed until you just made it up because the plot was about to go to hell. But, agreed, it's a better way to do it and done well, while kinda fudging, gives everything much more depth. (For example, could give you an excuse to bring in an NPC or group that might be able to work with the party in interesting ways. An ally can moderate difficulty AND repeatedly make a long storyline more interesting.)
Still, nothing wrong with "coincidentally" having a strong mob roll a nat 1 and eat dirt to buy a round or two while you figure out a way to put things back on track.
Whenever something seems to be moving towards a TPK, I make sure the players have some sort of reasonable escape. There may be one or two PC deaths, but nothing crazy. I think I ran OOTA with only 2 PC deaths for the whole campaign.
The other thing is that OOTA specifically gives you lots of NPCs at the start so they can take the brunt of the deaths.
My first time DMing went pretty similar. I put together my own adventure and chose monsters from the monster manual based on how cool they looked, only realizing that the numbers were an important consideration once I slaughtered all the players. All new DMs have a learning curve, it's just a matter of how deadly that curve winds up being.
My players have been having an easy time with the enemies so far, thanks to literally half of the 6-player party being paladins with 20+ AC and a cleric with also 20+. Tomorrow they are fighting a really nasty homebrew fire giant lord with a special armor and shield, legendary actions, and legendary resistances. I gave them an out because defeat will just mean losing a bunch of newly-found magic items and being sworn to the service of said fire giant lord for 10 years, but we'll see how much of a reality check this will be for them.
Edit: they nuked him in less than two rounds. The giant got out a fireball as a legendary action, and rolled really high... except all but one of them saved (with +2 to saves because fucking paladins) and then all but one of them also took half damage (because fucking Ancients paladin). Then he managed to do two attacks which did pretty good damage against a paladin, but not enough to take her out. Then he got out a stomp attack as a legendary action but everybody made the DEX save because, again, fucking paladins so it was useless. Then he got out a Circle of Death... that everybody managed to save against because fucking paladins, and everybody took half damage above that because, again, fucking paladins, so it did a whopping 9 damage to a bunch of them which amounted to jack fucking shit. And meanwhile he got blasted with divine smites, including a critical one (with some assist from a hexblade's critical eldritch smite and a crit from a ranger with a powerful homebrew bow (about as powerful as a Dragon Wing bow) combined with Hunter's Mark and Hail of Thorns).
I don't know what I hate more, paladins or WotC's game design philosophy. Seems like the only way to challenge a level 5+ party in combat is to make it a horrible slog through a dozen enemies. Or, y'know, the FromSoftware design philosophy of slapping down an enemy with 20000 HP and an enormous weapon that deals 20d12 damage in a 90 foot cone or a 90 foot long 15 foot wide line.