Read the introductory posts at the top of every section which tell you how to get the most out of this forum. Eg post code in case tags, ask a good question etc
“There is an error” is not a good description! Did your arduino explode?
What Arduino board do you have? You are aware that the Keyboard library requires a processor with native USB like a Leonardo, right?
From the library documentation:
The keyboard functions enable 32u4 or SAMD micro based boards to send keystrokes to an attached computer through their micro’s native USB port.
Read the forum guidelines to see how to properly post code and some good information on making a good post.
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
You can go back and fix your original post by highlighting the code and clicking the </> in the menu bar.
Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.
You will get better and faster help if you read and follow the guidelines.