Creativity is built into most animals including humans. In humans it has reached a stage where we even have nightmares. And wonder about things beyond us.
This and nothing else lies behind art. From the artist who drew pictures on cave walls to computer graphics to math and music.
Channeling this divine spark of Nature into meaningful art is not given to many as default. It is an acquired skill requiring hard work, heartbreak and despair. Literally it comes to slogging. Sometimes anyway.
How does this apply to writing. Once you get the seed of an idea there will be no further inspiration. Like God inspiration comes rarely. But again like God it is everywhere from a sneeze to a pandemic.
Once you get the kernel of the idea save it immediately. Like dreams they disappear.
After that it is hard labor, experiments, sleepless nights and often depression. But the seed of the story will grow in your mind; write down each step like a painter experimenting with color or singer training his voice to perfection. You need to be your own help and companion. For nobody can see into your mind.
Often you cannot see your mind either making you and your mind sad. Do not give up. The river of creation is not smooth.
Good Luck, fellow traveler.