Once we get over our fear of trying, there's 2 simple ways to keep from getting stuck when we're trying to write a new piece of music:
Firstly, it's the composer's job to come up with a good theme ... then just let that same theme, which is the idea or subject of the work, dictate the twists and turns the music will take [See blog, Inspiration, Parts I-IV].
This theme, like a seed, contains an invisible instruction on what to become [See blog, Seed].
The entire piece, in embryonic form, is locked up in this theme, and it's the composer's job to simply spin out a growth and development for that seed which allows it to sprout and fully bloom and bring out the best that's already within it.
Doing things backwards, i.e., prescribing a development and then trying to search for a seed that's an exact fit for it, can have us searching a long time to no avail.
Which is why the fastest way to get stuck, frustrated, and on our way to giving up and quitting is to first settle on every little detail of our composition ... the precise length of its sections and subsections, its keys, tempos, and meters ... everything in the blueprint ... before we even have a theme in mind and then try to work in reverse and think up thematic material and contents to satisfy and fill that framework.
We really can't even make a good, informed choice on a key for the piece until we have a look at the tessitura (range) of the theme, what position it needs (where it needs to hang) on the top staff to keep it from exceeding the range of the soprano voice, and whether or not it will stay within the compass of the pedals when performed on the bottom octave of the pedalboard.
Trying to invent a theme lastly, after everything else about the music has been decided and settled in the mind, everything about the architecture of the work has been planned out and established, and the bus has pretty much already left the station without the theme aboard, gets us into a predicament [See blog, Square Peg].
No wonder people get stuck (photo).
Put a little differently, we just need to take ourselves out of our own way so the innate creativity with which we were born can emerge and function at its best [See blog, Getting Started With Writing, Part XXVIII].
Secondly, the other way emerging composers get stuck is by not knowing how to develop their theme, once they have it.
If we talk with teachers of composition, they relate the story that their students usually don't have a great deal of trouble inventing themes for their pieces, but, once they do, they're sometimes not sure how to develop them, they tend to get bogged down over it, and their progress can get stalled, leading some of them to just give up and quit.
The solution for this is simply to familiarize one's self with the tools of the craft [See blog, Inversions, Retrograde, Sequencing, Augmentation/Diminution, Segmentation] which, by comparison, is the easy part ... to have ready a plan for how to handle a free theme or a fugue theme [See blog, Learning By Example, Audience Appeal, Ten Steps] ... and to have a look at several examples of how this might be put into practice [See blog, Your Ideas, Marching, Monotony, Apples, Look Inside, Getting Started With Writing, Parts I-XXVIII].
A very great deal about this can be learned right here, on this blog.