Lost between two macOS versions after failed upgrade to macOS Mojave
It appears that upgrade to macOS Mojave hasn't gone through and you are stuck in a state where you are unable to run the macOS Mojave installer via Mac App Store.

You can try locating the downloaded macOS Mojave installer locally under /Applications directory. The installer (if available) should appear by the name Install macOS Mojave.app. If you able to locate it, try running it manually.

If that too fails, you have a couple options:


Install macOS Mojave via Internet Recovery. Instructions can be found in the Apple Support article, About macOS Recovery.
Download macOS Mojave installer on a different Mac, create a USB bootable installer and install using it. Instructions can be found in the Apple Support article, How to create a bootable installer for macOS.


If you are installing using USB key, you'll need to hold down Option key while booting your Mac and choose the plugged-in USB key to run the installer. It would be advisable to erase the built-in disk and perform a fresh installation.

Once you have macOS Mojave installed successfully using either one of the above approaches, you can install Xcode normally via the Mac App Store.

As mentioned that you wish to develop and publish iOS apps. Publishing iOS apps requires current or just prior release of macOS with recommendation to use the latest iOS SDK and current version of Xcode.

As your MacBook supports running macOS Mojave, it's recommended to install it along with Xcode 10.2 (current as of this writing).