It's complicated, but it can be done.
So first, what you want to do is breed Mach Punch onto Magmar. You can do this by putting a female Magmar or Magmortar into the Daycare with a male Hitmonchan, Monferno or Infernape that knows the move Mach Punch. The resulted offspring should have the move Mach Punch. You also need this offspring to be female.
Now, what you want to do is put Mach Punch into the first move slot, so it will have a longer time to breed it. Put the female offspring with Mach Punch into the Daycare, this time with a male Hariyama or Makuhita with the move Belly Drum. The resulted offspring should have the moves Mach Punch and Belly Drum.
My offspring doesn't have the move Belly Drum/Mach Punch! What do I do?
Take the parents out of the Daycare and check if they still have the moves that you need on them. If not, then they were probably replaced by a level-up move. Just go to the Move Reminder and remember the required moves.
I'm only getting male offspring. Am I doing anything wrong?
No, you're not. Magmar has a gender ratio of 25% (F) to 75% (M). That means 3 out of every 4 eggs you hatch will be male, making it harder to get a Female. As I mentioned, it's a hard process, but it can be done through hard work and lots of time.