Scan barcode using usb scanner and save it as name of file in sd card

I connected USB scanner to Arduino mega using USB host shield to scan barcode which serially communicates with Arduino pro mini to save data in sd card.
I want to make file in sd card name as what i scan using usb scanner.

Can anyone please help me out?

(deleted)

I want to make file name as what i scan using barco0de scanner. since i cannot use both scanner and sd card on same arduino, i use two different arduinos which will do serial communication. Here is the code for both arduinos.

sdcardlogger.ino (1.01 KB)

printer_scanner.ino (7.66 KB)

since i cannot use both scanner and sd card on same arduino

Can you please explain why you have this restriction.