How to do this task?

uint8_t howManyLedsOn;

void loop ()
{
  howManyLedsOn = map (lightLevel, 0, 1023, 6, 0);
}

@milkytea Define the LED pins at the start of the program, then make an array of them in the same order you want to light them on. Use a while or a for loop limited by the variable howManyLedsOn to turn on and off the members of the array sequentially.