A composer is someone who writes (composes) music. Some composers work by writing music down on paper; this is called 'written notation'. Classical music writers work this way. Writers for TV and movie music also usually write this way, so that an orchestra or other players can read the music and play it.
Some musicians are very good at improvisation. This means that they think up (invent) the music as they play it. Some church organists are good at improvising. During a service they may need to play some organ music to fill in the gaps while people are collecting money or taking communion. Jazz musicians are usually excellent at improvising. Improvisation is not written down, so each time it is different.
Popular and rock or soul music writers are often not able to read and write music down. Many pop and rock composers compose their songs on a guitar or piano. Cole Porter and Irving Berlin usually composed at the piano.
Many songs are written by two or more people. It is common for two people to work together to write songs. Sometimes, one person writes the music and one writes the words (the lyrics). Some songs such as folk songs were composed many years ago and no one knows who wrote them.