How to use an Arduino Uno + Keyboard Firmware to make a "N Key Rollover" Game Pad
You don't want to send random keys do you?

Well consider using the code below as your base.
It's using Port Manipulation to read the buttons (Digital 0 to 7).

void setup() 
{
  Serial.begin(9600);//Start serial connection.
  DDRD = 0b00000000; //Set Data Direction Register of port D to inputs (attach keys to digital pins 0to7;
  delay(200); //Misc delay.
}

void loop() 
{
  Serial.write(PIND, 8);    // Send states of PORTD (digital 0 to 7)
}


I strongly suggest you use pull-down/up resistors on the buttons also.
Adjust your code to the amount of keys you're using, or pull the pins low if not used. To avoid receiving random/floating pin values.