how to Compare data in saved in SD card csv file with Keypad input??

I am trying to write an Arduino code to check passwords that saved in a file on SD Card if the password entered via Keypad are matched with saved passwords. password length is must to be 4 numbers only. the code also is required to read data from altitude sensor when there is no obstacle in front of IR sensor and then save altitude sensor data into a new file. I do not know what is it wrong ! but the comparison between entered password and saved ones is not working :’(

this is my code:

#include <Keypad.h>
#include <Password.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>
#include <SD.h> 
#include <SPI.h> 

File mySensorData;
File Trials ;
File NamePass;

Adafruit_BMP280 bme;
float Temperature , Pressure , Altitude ;
String newPasswordString; //hold the new password
char   newPassword[4]; //charater string of newPasswordString
int chipSelect = 10; 


//initialize password to 1234
//you can use password.set(newPassword) to overwrite it

Password password = Password( "1234");

byte maxPasswordLength = 4; 
byte currentPasswordLength = 0;

const byte ROWS = 4; // Four rows
const byte COLS = 4; // Four columns

//Define the keymap
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};

//// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte rowPins[ROWS] = {6,7,8,9}; //connect to row pinouts

// Connect keypad COL0, COL1, COL2 and COL3 to these Arduino pins.
byte colPins[COLS] = {5,4,3,2}; //connect to column pinouts

// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup()
{
 Serial.begin(9600);
 Serial.println(F("BMP280 test"));
 Wire.begin ();
 SD.begin(10); 
 if (!bme.begin())
 {  
   Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
   while (1);
 }
}

void loop()
{
 char user , Name ,key ;
 user = (key + "," +  Name) ;

 user = SD.open ("NamePass.csv" ,FILE_READ ) ;
 
   key = keypad.getKey();
   if (key != NO_KEY)
     {
        Trials = SD.open("trials.csv", FILE_WRITE);
        Trials.print(key ,password.evaluate());
        Serial.print(key);
       currentPasswordLength++;
       password.append(key);
         if (currentPasswordLength == maxPasswordLength) 
         {
         
                if (password.evaluate())
                {
                 for(;;)
                 {
                    Serial.println(" OK.");
                    Serial.println(key,Name);
                    mySensorData = SD.open("Data.csv", FILE_WRITE);
                    Temperature  = bme.readTemperature();
                     Pressure    = bme.readPressure   ();
                     Altitude    = bme.readAltitude   ();
                     
                         Serial.print( "Temperature = \t " );
                         Serial.print(Temperature);
                         Serial.print( "\t Pressure = \t " );
                         Serial.print(Pressure);
                         Serial.print( "\t Altitude = \t " );
                         Serial.print(Altitude);
                         Serial.println();
                         
                         delay(2000);
      
                         mySensorData.print(Temperature);
                         mySensorData.print( " \t " );
                         mySensorData.print(Pressure);
                         mySensorData.print( " \t " );
                         mySensorData.print(Altitude);
                         mySensorData.println();
                         mySensorData.close();   
                    
                 }
                    
                } 
                else 
                {
                    Serial.println(" Wrong passwowrd!");
                 }
                  currentPasswordLength=0; 

                
         } 
     
     }
}

Please edit your post and type
** **[code]** **
at just before the code and
** **[/code]** **
just after it.

The result will be

your code

What do you think that this does?

  user = (key + "," +  Name) ;

SD.open returns a FILE, not a char, so below does not make sense

  user = SD.open ("NamePass.csv" , FILE_READ ) ;

You should also check the return value of SD.open before using it.

The below line, when the variable is ever used, is probably calling for trouble

char   newPassword[4]; //charater string of newPasswordString

I have no experience with the Password library; no idea what its benefits are over a simple C implementation of strcmp.