program execution is not as intended

I copied your code to my editor so I could look at it properly but I think I have lost the will to live.

Why have you all that stuff in loop() so that it is impossible to see what is going on without laboriously working through the code.

Make separate functions to read the RFID stuff and to do whatever is done with tagfound etc etc.

Then it would be possible to isolate the problem to a few lines of code.

...R