Problem with analogWrite

The Mega has 15 PWM pins, so 12 left if you had used the EN pins of the motor drivers for speed control.
If you want more pins, then use port expanders, not relays.
Leo..