Hi, the easy answer is "just keep trying", but I know that isn't helpful so here's a few thoughts on this.
1 - Listen to lots of music of different styles, especially things you don't normally hear, classical, jazz, anything. This will make sure you are exposed to plenty of musical ideas which you can draw influence from, even though you may adapt them into your own preferred style.
2 - Focus on your lyrics. If you have good lyrics you should 'feel' where the emphasis needs to be, where they need to go up or down, which syllables and words need more of less emphasis, where you need to speed up or slow down, where you back the music off and where you make it louder. Let the lyrics dictate the melody.
3 - once you have a melody you can work out the chords and/or riffs. This is where some musical theory would be useful so you know what flavour of chords to use; major, minor, seventh etc. Don't forget you don't always need a full chord too, often you can 'suggest' a sound with only to or three notes of a chord.
4 - Learn about song structure. It does depend whether you are aiming at commercial success or personal satisfaction but there are a lot of tried and tested structures and techniques which are well documented.
5 - Experiment and break the 'rules'. Music is creative and history is full of great bands that ignored (recreated) the 'rules'.
6. Keep trying and never give up. Try recording as much as you can, whether full songs or just fragments. You'll build up a library of ideas that you can draw on and create new combinations in the future.
7. Collaborate. If you're lucky enough to write/compose with others you'll benefit enourmously. You may not create exactly what you set out to, but you will create.
Good kluck