You can't rewrite the IMEI, I've have that issue before and I created a guide on how to fix it
https://forum.xda-developers.com/mi-a2-lite/how-to/guide-to-fix-efs-corruption-sim-card-t3928910/amp/
Enjoy ?
You can download the latest rom and install it (ignore the rom that's in the guide it is...