'Keyboard' not found when trying to use Keyboard.write from the  library
The Mega2560 can't be a keyboard. It lacks the required hardware.

Instead you need to use one of the pure USB boards, like the Leonardo.