Why and how do lawyers accept (morally), and defend those criminals that provenly did something horrible?

Because providing the best possible legal defense to a monster lessens the possibility of a mistrial.

Everyone is legally entitled to competent legal representation, if a defense lawyer intentionally bombed a case because the defendant was monstrous and unquestionably guilty it would give the monster another chance to get away by crying mistrial. (And it would be valid if the defense lawyer intentionally bombed)

Besides, if the defendant is unquestionably guilty they’re going to jail either way, the lawyer’s job becomes to ensure the criminal is fairly punished when punishment is inevitable.