Just do it. A lot. After you do it, listen to historically important musicians, as well as your favorites for more ideas, then do those. Then do all of this for years and years.
You can also try the good ol' "write one song a day for x amount of days". I've heard that works pretty well.