Okay, this method is working for me except the last, but i solved it:
I patched the AP file in Magisk Manager, copied back to my pc, opened the tar file with 7zip and deleted all files except recovery.img and vbmeta.img.
I opened the original prepatched AP file in 7Zip and extracted the boot.img.lz4 and dragged it to lz4.exe.
I copied the uncompressed boot.img to my phone and patched it in magisk manager, copied back the patched file to my pc and put it in the tar file, flashed with odin (before flashing I unticked the auto reboot), after it's done, I pressed and held volume down and power and when the screen went off, quickly changed to volume up and power button and hold until the bootloader warning appeared, I released the buttons, and I pressed the power button to continue to samsung logo, and my phone got bootloop (after a few seconds).
After it restarts and the screen went off I quickly pressed and held the volume up and power button until the bootloader warning appeared again, pressed the power button, and after the samsung logo appeared, quickly pressed and held the volume up until the stock recovery does not appear -> stock recovery -> mount system -> reboot to the system -> hold volume up and power button (!) -> bootloader warning - press power button to continue -> samsung logo -> press and hold the volume up until the recovery does not appear -> recovery -> reboot to the system -> wait until the bootloader warning (and do not press and hold volume up and power (!) ) -> press the power to continue -> samsung logo, and wait and the phone is booted and working with magisk root. If you reboot the phone or shutdown it, magisk root is still working without pressing volume up and power.