You're over-thinking the problem. Trying to write the .img to disk again is only going to cause problems because the .img format we use for releases is designed only for overwriting an entire disk. Make a one-time manual install of the partitions and filesystems, and then 'update' to newer versions as required. An update replaces the entire embedded portion of the OS (via KERNEL/SYSTEM) and if you need to wipe the Kodi config all you need to do is stop Kodi and rename /storage/.kodi to /storage/.kodi-old and reboot. On restart you have a completely clean Kodi config. Config items also exist in /storage/.config or /storage/.cache, but it's unlikely that you need to touch anything there.