Unfortunately I don't think that wouldn't work.
A kvm switch monitors the keystrokes coming from the keyboard, the actual electrical signals, and doesn't receive any output from the computer. Emulating keystrokes to the o/s wouldn't generate the signal that actually pressing the key would.
Then again all the kvms I use at work aren't super nice. You might be able to find one that has an interface for it.