i need atmega 16 output to toggle using switch
Your description of the desired functionality is a bit ambiguous.

I will assume the following. If this is not correct, then indicate so in the comments to this answer and I will adjust it accordingly.

Normal operation is that the PIR sensor determines if the LED is on or off. However, through an infrared remote control, you would like to toggle the state of the LED. You would like the LED to remain in that state until the next PIR or IR control event.

Your current code is constantly examining the level of the inputs and changing the output based on this information, this is called level sensing. Instead, your code should perform edge triggering. This is where the code takes some action only when the state of the input changes from low to high or high to low, as appropriate.

The basic technique for performing edge detection is to save the value of the input bit each time and the next time the input bit is read, compare it to its previous value.  If it is not the same, it has just changed states (you detected the edge of the pulse). You can now take appropriate action based on the direction of the change. This entire mechanism will add only a half dozen or so lines of code to your program.

Here is some pseudo code that catches as rising edge of a port bit input:

IR_MASK = 0b00000001;
IR_INPUT = (PINB &amp; IR_MASK);       /* mask off the other bits
if (IR_INPUT ^ IR_LAST)            /* if true, we caught an edge (change)
{
     IR_LAST = IR_INPUT;           /* save the new IR input bit value
     if (IR_INPUT);
     {
          /* put any rising edge code here
     else {
          /* put any falling edge code here
     }
}