@JRCL you need to use M950 to configure the port as a GPOUT port, then use M42 to control it.
The L298N accepts TTL-level input voltages, so it can be driven form 3.3V signals such as the exp.heaterN pins on the Duet 2 expansion connector. However, at reset these pins are all pulled high at startup by the internal pullup resistor in the microcontroller. So you should probably invert the pin name in the M950 command in order that when you send the MN950 commands, the output doesn.t change.
You may also want to drive the Enable input of the L298N from another output of the Duet. In this case you should not invert that output, but you should connect a pulldown resistor of about 4.7K between that output and ground so that the L298N remains disabled at power up.