Learn IR remote

Hello, I have a problem sending the IR code from Arduino. The program works on the principle that when the button (9) is held down, the programming mode is switched on and if I press another button(7,8,10,11), I can reprogram it with a code from the IR receiver. When I release the button, I can send this recorded code via the IR diode transmitter. But there is a problem and it is still cycling. But when I turn off sending code to the IR diode (//IRS.sendNEC(codes[index],32);), but I send it to (Serial.print), it works all right without cycles.

#include <IRremote.h> 

const byte IR_pin = A5; 

IRrecv IRR (IR_pin); 
IRsend IRS; 

unsigned long int codes[4]; 

void setup()
{
  pinMode(9, INPUT_PULLUP); 
  pinMode(10, INPUT_PULLUP);
  pinMode(11, INPUT_PULLUP);
  pinMode(7, INPUT_PULLUP);
  pinMode(8, INPUT_PULLUP);
  pinMode(13, OUTPUT);
  Serial.begin (9600); 
  IRR.enableIRIn (); 
}

void loop()
{
  if (digitalRead(9) == LOW) 
  {
    Serial.println("Programing buttons");
    digitalWrite(13, HIGH);
    while (digitalRead(9) == LOW)
    {
      if (digitalRead(7) == LOW)
      {
        Serial.println("Programming to button 7");
        Recieve(0);
      }
      else if (digitalRead(8) == LOW)
      {
        Serial.println("Programming to button 8");
        Recieve(1);
      }
      else if (digitalRead(10) == LOW)
      {
        Serial.println("Programming to button 10");
        Recieve(2);
      }
      else if (digitalRead(11) == LOW)
      {
        Serial.println("Programming to button 11");
        Recieve(3);
      }
    }
    Serial.println("End of Programing buttons");
    digitalWrite(13, LOW);
  }

  if (digitalRead(9) == HIGH)
  {
    digitalWrite(13, HIGH);
    while (digitalRead(9) == HIGH) 
    {
      if (digitalRead(7) == LOW)
      {
        Serial.println("Sending from button 7");
        Sending(0); 
      }
      else if (digitalRead(8) == LOW)
      {
        Serial.println("Sending from button 8");
        Sending(1);
      }
      else if (digitalRead(10) == LOW)
      {
        Serial.println("Sending from button 10");
        Sending(2);
      }
      else if (digitalRead(11) == LOW)
      {
        Serial.println("Sending from button 11");
        Sending(3);
      }
    }
  }
}

void Recieve(byte index)
{
  decode_results IR_data;
  if (IRR.decode (&IR_data))
  {
    codes[index] = IR_data.value;
    IRR.resume ();
    Serial.println(String(index) + " is: " + String(codes[index], HEX));
    blink(2);
  }
}

void Sending(byte index)
{
  
    String target = String(codes[index], HEX);
    target.toUpperCase();
    target = "0x" + target;
  
  
  //IRS.sendNEC(codes[index],32); 
  
  Serial.println(String(index) + " is: " + String(codes[index], HEX));
  delay(200);
}

void blink(byte count) 
{
  for (byte i = 0; i < count; i++)
  {
    digitalWrite(13, LOW);
    delay(100);
    digitalWrite(13, HIGH);
    delay(100);
  }
}

You act on buttons, while they are pressed, not when they become pressed.

Look into the state change example, or use a button library like Bounce2,
that handles bouncing and state change detection.

When i Touch down button(9)=> programming mode is ON
When i Touch up button(9)=> programming mode is OFF

You are repeatedly calling Receive(n) or Send(n) for as long as a button (7,8,10, or 11) is LOW. When you start the programming of a button you should probably wait until you receive the signal:

void Recieve(byte index)
{
  decode_results IR_data;
  while (!IRR.decode (&IR_data)) {}
  {

It is still cycled

Fisrt try it work(When i press button(9) programming mode is on, and when i press some of buttons(for example 7) i can rewrite ir code on this button(7). When i Touch down button (9), programminfg mode is OFF and when i click button(7) it send rewrote code. ) but when i want try it again with some other button, it wont recieve new code to button.image

That could mean that only button 7 is wired correctly. Check the wires.