i am unable to make a correct program using the pushbutton to toggle LED on/off?
I would use a different approach

int led = 13;
int buttonpin = 8;
boolean waspressed = false;


void setup (){ 
    pinMode(buttonpin,INPUT);
    pinMode(led,OUTPUT);
    digitalWrite(led,LOW);
}

void loop(){
    if(digitalRead(buttonpin) == HIGH){
        waspressed = true;
    }else{
        if(waspressed == true){
            digitalWrite(led, !digitalRead(led));
            waspressed = false;
        }
    }
}


We can understand it better if we just take a step by step view. When the controller is started, it first executes the setup(), setting the led pin as output, buttonpin as input and setting the led pin value to low. The led pin is set to LOW because it needs to have an initial value once it is an output. The initial value can also be HIGH without changing the behavior of the circuit. Always remember to set an initial value to all your output pins. This prevent them to float, which may lead no unpredictable results.

The loop() can be a little more tricky.

State 1 - button not pressed

The first interaction tries the value of buttonpin:if(digitalRead(buttonpin) == HIGH). Once the button is not pressed (buttonpin is LOW), the interpreter moves to the else element. At this element, there is another conditional - i.e, another if. This conditional looks for the value of waspressed. This is false, as set at the begging of the code. Because of this, the information inside the conditional is not executed and the loop() is executed over and over with no change until the button is pressed.

Stage 2 - button is pressed

When the button is pressed, the next iteraction of loop() will catch this action when trying the first conditional if(digitalRead(buttonpin) == HIGH). Once buttonpin is high if the button is pressed, waspressed will be set to true. This will repeat as long as the button remain pressed.

Stage 3 - button is released

After being released, the first conditional will read buttonpin as LOW, and the interpretor will move the the else element. At that element, it will try the second conditional if(waspressed == true). Until now, there is no difference from what was executed at the first stage, however this time, waspressed is true because it was set true when the button was pressed. This leads the interpreter inside the conditional and execute the lines

digitalWrite(led, !digitalRead(led));
waspressed = false;


The first one set the led pin to the opposite value it has. I.e, if the led pin is HIGH, it becames LOW, if it is LOW, it becames HIGH. This happens because !digitalRead(led) outputs the complement of the value of digitalRead(led) - without the !.

The second one set waspressed to false again. With this, the next iteration will be back to stage one and wait for another press on the button.