Why does the Serial Monitor add a box to my input?

It gives me a box in the serial monitor stopping it from giving me the correct code to unlock.

This is the code that im trying to use for my safe lock.

The photo that i’ve included shows the box that shows up and also will end up going through many other symbols.

#include <Keypad.h>
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
char AccessCode[4] = {1,6,0,3};
LiquidCrystal_I2C lcd(I2C_ADDR, En_pin, Rw_pin,Rs_pin, D4_pin, D5_pin,D6_pin, D7_pin);
const byte numRows = 4;
const byte numCols = 4;
char string[4];
int n = 0;
int l = 0;

char keymap[numRows][numCols]=
{
{‘1’,‘2’,‘3’,‘A’},
{‘4’,‘5’,‘6’,‘B’},
{‘7’,‘8’,‘9’,‘C’},
{’*’,‘0’,’#’,‘D’}
};

byte rowPins[numRows] = {9,8,7,6};
byte colPins[numCols] = {5,4,3,2};

Keypad myKeypad = Keypad(makeKeymap(keymap), rowPins, colPins, numRows, numCols);

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin (16,2);
lcd.setBacklightPin(BACKLIGHT_PIN, POSITIVE);
lcd.setBacklight(HIGH);
lcd.home();
lcd.print(“1603”);
delay(3000);
lcd.clear();
lcd.print(“Please Input”);
lcd.setCursor(0,1);
lcd.print(“Code”);
delay(3000);
lcd.clear();
Serial.print(AccessCode);
}

void loop() {
// put your main code here, to run repeatedly:
char keypressed = myKeypad.getKey();
if (keypressed != NO_KEY)
{
lcd.print(keypressed);
Serial.println(keypressed);
string[n] = keypressed;
n++;
Serial.println("Current password = ");
Serial.println(string);
}
if (string[1] == AccessCode[1] && string[0] == AccessCode[0] && string[2] == AccessCode[2] && AccessCode[3] == AccessCode[3]){
lcd.clear();
lcd.print(“CONGRATULATIONS”);
}
}

After entering your combo what other key do you press to cause the entered value to be sent, such as the enter key?

I currently don't have an enter key

Your variable "string" needs to be terminated in a null character if you are going to print it, otherwise Serial.print does not know where it ends, and defining it as "char string[4]" only allows for 3 characters plus the terminating null character. I also don't see anything in the code to make sure you are not exceeding the length, if someone typed in 5 characters that will give you problems.

thanks it works now