The safest, albeit most expensive, method is taking the phone to an authorized service center. Conclusion
Save yourself the headache. Do not rely on Magisk modules for hardware-level repairs. If you have lost your IMEI, the correct path is to flash the stock firmware for your specific region using ODIN (Samsung) or Fastboot (Xiaomi/Pixel) to see if the EFS partition resets. If that fails, you need professional hardware tools or a trip to a service center. The "Verified" badge on a Magisk module does not guarantee a working phone—only a working app interface. imei repair magisk verified