I learned some songs on the piano, and I can play the songs perfectly but when I try to write a song I can't play what I'm thinking of
that's probably because you haven't learned to actually 'play', like, the fun way. that will actually make the other songs sound better too, not just your own. ..... how do you learn to play? by playing of course