I'm not sure how I would go about writing a Megatron redemption storyline. It would definitely depend on the continuity and both the scale of his acts, and his core motivation
That being said, I like the idea of playing around with a death wish Megatron. He isn't suicidal per se, rather he thinks that if he can sacrifice himself for a good enough cause, it will be enough to redeem him, or at least turn him into a martyr instead of a monster.
Because that would be easy, wouldn't it? He does something Good(tm) and he doesn't have to stick around to continue to bear the weight of his misdeeds. Which is exactly why it needs to fail.
Megatron doesn't get to die, at least not on his own terms. He will have to live and contend with his actions, and have to choose how to carry forwards