First of the .*iml files do not have anything to do with your code. It is only a file created by the IDE to contain module information.
If you are using maven you can reimport your projects modules as follows:
Go to File > Project Structures > Modules > Add > Import Modules > > OK.
After that you have to go to the maven Tool window and click on the reimport button.
Intellij has a lot of interesting features and for that it makes use of cache. That sometimes makes problems like this. After invalidating caches and restarting IntelliJ the dependencies that were cached are removed and updated on the next compiling, and these errors were fixed.
In IntelliJ, start by creating a new Kotlin project. You will be asked to choose the project type, at which point you can choose a pure frontend application or a full-stack web application depending on what suits your needs best. You may need to wait a few minutes for all the necessary dependencies to finish downloading.
You should then see your project. Within the src/main directory you will be able to find your main .kt file containing the script's starting point and an index.html file in the resources directory. Note that inside of the HTML file, the only script that is linked is one .js file, named the same as your project. This file will be generated at compile-time and will contain all your compiled Kotlin code.
To run the project, you can bring up the Gradle tool window from the View menu, and run the browserDevelopmentRun Gradle task to run your project for the first time. This may take a couple of minutes the first time you do it.
However, you probably don't want to be manually stopping and restarting your web server every time you make a change to a file. By bringing up your run configurations tool window, you can edit the newly created browserDevelopmentRun configuration. In the Arguments text field, add the argument --continuous and save your changes. Upon next run, this will make the system continuously listen for changes and update your browser automatically.