How do I download kodi onto an amazon fire TV box?

Hi I bought a fire box last year with kodi already installed but tonight the box is playing up and not connecting to the internet but my other devices are. I want to try a factory reset but I don’t want to be without kodi.

Can anyone tell me how to reinstall it?

Thanks