L298N motor controlling controlling isues (code problems)

The motor drivers are cut off the picture, so I can 't see the actual connections, but I see two possible problems.

You are never turning off the motor drive signals, only turning them on.

When the switch on channel 36 is HIGH you set a value on channels 2 & 4. That works just fine. But when the switch on channel 37 is HIGH you set values on 3 & 5. You now have PWM signals on all four channels. Is that what you want? Shouldn't you turn channels 2 & 4 off before you turn 3 & 5 on? The same thing seems to be true of 6, 8, 9, 10 and 11. I don't see where they ever turn off.

I would suggest something like this

  if (digitalRead(36) == HIGH)
  {
    digitalWrite(45, HIGH);
    digitalWrite(46, HIGH);    
    analogWrite(2, 0);
    analogWrite(3, 0);
    analogWrite(4, 0);
    analogWrite(5, 0);
    analogWrite(2, outputMotorValue);
    analogWrite(4, outputMotorValue);
  }
  else
  {
    digitalWrite(45, LOW);
    digitalWrite(46, LOW); 
  }
  if (digitalRead(37) == HIGH)
  {
    digitalWrite(45, HIGH);
    digitalWrite(46, HIGH);    
    analogWrite(2, 0);
    analogWrite(3, 0);
    analogWrite(4, 0);
    analogWrite(5, 0);
    analogWrite(3, outputMotorValue);
    analogWrite(5, outputMotorValue);
  }
  else
  {
    digitalWrite(45, LOW);
    digitalWrite(46, LOW); 
  }

That way only the commanded outputs will be on. All others will be off. You may need to change the value to 255 depending on the polarity of the signal. You can also accomplish this with a digitalWrite.

Are you driving both sides of the H-Bridge with a PWM (In1 & In2 on the L298). Generally when driving an H-Bridge you turn one transistor on and PWM the other. You can get strange behavior when you PWM both sides if the signals are not synchronized correctly. I assume you are using a regular DC motor (not a stepper motor). When you want to drive the motor forward, set In1 high and PWM (analogWrite) In2. When you want to reverse the direction set In1 low and PWM In2.