Need help with while loops

You should post your try to combine the two sketches.
SHowing how you tried to combine them helps to analyse what you did wrong and to write what you have to change.

The RFID-code is taken from a working example-code and only slightly modified.
I estimate that you do not yet understand what the code return is really doing.

The negative number makes no sense.
You should look up what the function write() does.

You always have a loop:

This loop is

void loop() itself

as the name says it is looping.
if parts of your code shall only be executed if certain conditions are true
you make the code-execution conditional by using if-conditions.

Or by using the switch-case-break-statement.

Using the switch-case-break-statement will reduce the number of nescessary if-conditions to the minimum because the switch-case-break-statement makes code-execution mutual-exclusive.

The effect is:

Only that parts of the code that are nescessary are executed all other parts are not.
like in a while-loop
with the big difference that you are not locked inside a small loop
you are free to execute additional code.

basic principle of non-blocking coding

demo-code how to use the switch-case-break-statement

best regards Stefan