It’s possible to control a PWM pin using an output_pin config section.
However, as I understand it, typical CNC gcode files user gcodes that Klipper doesn’t currently support. It might be possible to add support for some of these commands via gcode_macros. There’s been discussions in the past on adding more CNC support to Klipper, but no one has completed that work to my knowledge.
-Kevin