Try this. Maybe we could get lucky. With the keyboard connected, and the Mac connected to wifi, reboot into Recovery (Cmd-R). When Recovery comes up, without bothering to run Disk Utility, select to install macOS. You may have to sign into your wifi network. It will offer the latest version that your Mac will run.
Go through the installation process and when it’s done, keep your fingers crossed that you will got the login screen.