How to pass value of a function from the RFID-RC522 library into a variable then be sent into either serial or ethernet?
As far as I can understand, you expect to receive byte data from the RFID reader, you would like to store this data into a single variable, and eventually print its content, or manipulate it in some way. You could do this maintaining a byte array (or uint8_t array).

Let's suppose, for example, to receive a unique ID of length 4 from the RFID reader. In this case you could simply store it into a serNum[serNum_size] array, where serNum_size is just the number of data you are expecting to receive, and later access its content for whatever manipulation you would like to do.

int serNum_size = 4;        // reader data size
byte serNum[serNum_size];   // reader data content

for(int i = 0; i &lt; serNum_size; i++){
 serNum[i] = mfrc522.uid.uidByte[i]; // store reader data block
 Serial.print(serNum[i], HEX);       // hexadecimal form
}


As far as the print is concerned, you can simply print the byte entry and apply the HEX format. In this way, the stored value will be considered as its hexadecimal value.