Here is a simple secret for writing a great song. Use an audio recorder on your iphone to objectively listen to each section of a song. If you are struck with an idea, you can quickly record it. Then listen to it.
Does it sound as good played back as it did when you played it? What if you changed this little vocal line here? What if you changed the tempo? Make revisions as necessary. Then listen again. Do this until you can go through a verse, then the chorus, etc. without stopping because something isn’t perfect.