Safe with Display and Buttons

    if(n1btn==LOW){
      //How do i set a code in here?
    }

Don't worry about that, yet. You want to record the fact that the nth switch HAS BECOME pressed, in the mth position in the array that you don't have.

You MUST look at the state change detection example to learn how to detect that a switch HAS BECOME pressed.

Your entire code is based on the "do nothing unless" principal, which is a lousy way to program.

Instead, it should be based on a "do something if" principal.

On any given pass through loop(), you should read the state of all 6 switches, and compare the current states to the previous states. When a change is detected, you then need to decide if the change was from not pressed to pressed, or from pressed to not pressed.

There may be things you want to do when a given switch becomes pressed, and there may be things you want to do when a given switch becomes released. Or, one change may be completely meaningless.

As you can probably imagine, being able to read the 4 number switches in a for loop would be advantageous. Instead of blowing off arrays because you don't know anything about them, hit the reference page and learn something.

byte numberPins[4] = { 6, 7, 8, 9 };
byte currStates[4];
byte prevStates[4];
byte lockCode[4];
byte lockIndex = 0;

void loop()
{
   for(byte b=0; b<4; b++)
   {
      currState[b] = digitalRead(numberPins[b]);
      if(currState[b] != prevState[b])
      {
         // The state of the bth pin changed...
         if(currState[b] == LOW)
         {
            // to pressed...
            if(lockIndex < 4)
            {
               lockCode[lockIndex++] = b+1;
            }
         }
      }
    }

    // Deal with the SET and CLEAR switches here
}

This is NOT complete. It is simply meant to show you how arrays can REALLY shorten your code. You'll still need to deal with the two modes - set the initial code and open the safe.