How to compare gathered barcode with determined code

Looks like it displays the key presses as they arrive but doesn't store them anywhere:

    key= char(schluessel);
    lcd.print( key );
    Serial.print(key);

I think you will need to store the characters in a buffer. Is there some marker that indicates the end of input from the scanner? If not, you may need a timeout to detect when the input is complete. Then you can compare the buffer against the desired data.