Ledcube dice code problem

Hello i did ledcube with a button. when i press button its generate randomly a number with that number leds gona light. But when i press button every leds is turn on what i did wrong can u help me?

here’s the code

int buttonPin = 24;
int buttonState;
long ran;
int time = 2000;
void setup() {
pinMode(1,OUTPUT);
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);

  pinMode (buttonPin, INPUT);
  randomSeed(analogRead(0));
}
void loop()
{

  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH){
    ran = random(1, 7);
    if (ran == 4){
      for (int kat = 10; kat <= 18; kat++){
      digitalWrite(3,HIGH);
      digitalWrite(9,HIGH);
      digitalWrite(2,HIGH);
      digitalWrite(kat,HIGH);
    }
      }
  if (ran == 3){
      for (int kat = 10; kat <= 18; kat++){
      digitalWrite(3,HIGH);
      digitalWrite(5,HIGH);
      digitalWrite(kat,HIGH);
    }
      }
  if (ran == 2){
      for (int kat = 11; kat <= 18; kat++){
      digitalWrite(4,HIGH);
      digitalWrite(8,HIGH);
      digitalWrite(kat,HIGH);;
    }
      }
  if (ran == 1){
      for (int kat = 11; kat <= 18; kat++){
      digitalWrite(5,HIGH);
      digitalWrite(kat,HIGH);;
    }
      }
  if (ran == 5){
      for (int kat = 10; kat <= 18; kat++){
      digitalWrite(5,HIGH);
      digitalWrite(3,HIGH);
      digitalWrite(2,HIGH);
      digitalWrite(9,HIGH);
      digitalWrite(kat,HIGH);;
    }
      }
  if (ran == 6){
      for (int kat = 10; kat <= 18; kat++){
for(int kolon=1; kolon<=9; kolon++){
  digitalWrite(kolon,HIGH);
}
digitalWrite(kat,HIGH);
}
}
    }
  }

You spend a lot of time writing pins HIGH, but you never write any of them LOW again. So it won't take long before everything is lit up.

thank you i wrote low end of codes and added delay and it work thank you