How did you setup your serial console ?
Usually one adds a Keyboard.begin(); in the setup as well (even if it’s useless at the moment)
#include "Keyboard.h"
void setup() {
Serial.begin(115200);
Keyboard.begin();
}
void loop() {
if (Serial.available() > 0) {
char c = Serial.read();
Keyboard.write(c);
}
}