How to compress an hexadecimal number into a short string?

The problem is that you have two variable using the same name. Give them different names.

EDIT following helpful comments by @BulldogLowell in Reply #28

You have an global array local to the loop function

byte tagEPCBytes[50][12];

and a local byte with the same name local to that block of code

byte tagEPCBytes = nano.getTagEPCBytes();

and the local variable in the block takes precedence.

The byte variable tagEPCBytes is used to hold the number of bytes in the tag so maybe it would be better called tagEPCByteCount

...R