I'd cut out a rectangle slightly larger than the damaged section, and replace it with a new piece of MDF. Just gluing in the piece isn't going to be strong enough, you'll need to use biscuits or dowels to reinforce the joint. If you don't have a biscuit joiner, a router with a slot cutting bit will also work. Then fill any remaining gaps with wood filler/ Bondo.
You could try using a filler like Bondo alone , but the damage on the bottom piece looks a bit too severe for that.