I updated an existent system (Magisk 18.1 was already installad): simply wipe cache\dalvik cache, flash rom, sign boot and reboot.
When I installed Magisk, that's what I did:
- flash rom, gapps, sign boot
- after first boot, i went back in recovery and flashed Magisk-v18.1.zip, sign boot and reboot
You can achieve root on Lineage OS also flashing the su addon.