Arduino Uno as Keyboard

I am trying to make Arduino uno to act as a keyboard, i have successfully flashed the USB-HID firmware in it using this link also and programmed it like this.

uint8_t buf[8] = {
 0
};

int inpin1 = 7; 
int inpin2 = 8;
int val1 = 0;
int val2 = 0;

void setup()
{
  Serial.begin(9600);
  delay(200);
  pinMode(inpin1, INPUT);
  pinMode(inpin2, INPUT);
}

void loop() 
{
  val1 = digitalRead(inpin1);
  if(val1 != HIGH)
 {
   buf[2] = 80; // Left Arrow
   Serial.write(buf, 8);
   releaseKey();
 }

val2 = digitalRead(inpin2);
if(val2 != HIGH)
{
   buf[2] = 79; // Right Arrow
   Serial.write(buf, 8);
   releaseKey();
}

 }

void releaseKey()
{
  buf[0] = 0;
  buf[2] = 0;
  Serial.write(buf, 8);
 }

The above code works fine but the problem is that, when i tried to play a game which uses right arrow and left arrow and to control car i was using the push button which i connected to arduino as left and right arrow keys. But suppose if i want to turn a car. I have to press the key and then release the key to move it a very little to the right or left. So, if i want to turn the car either left or right, i have to press and release so many times that it becomes impossible to play the game. Do you anyone know how to resolve this problem.

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read.

From reading your code it appears that you could just hold the button down and it will keep turning, no need to repeatedly press the button. Is this not the case?