Why the led is blinking instead of keeping on atmega8
As confirmed in the comments, the AVR had a watchdog timer that  needs to be pet or put to sleep. Without this, the watchdog will dutifully do is job, and reset the microcontroller once the timer elapses. This results in the AVR setting it's pins to their default state,  which is most often high Z input state. This explains the on and off toggling of the pins that OP saw.