A sample is simply the sound, or the instrument, that will play note. Even if I have a full partition (let's say in midi file), it won't produce any sound if I don't put samples on it.
So when we compose, we compose on different tracks at the same time (one track = one instrument, or group of instruments). Then, we apply one sample on every track to produce the sound. Obviously, better sounding samples cost more, but can do a big difference.
The process of writing the partition, meaning the notes in the midi files (that produce sound) is done is a music notation software, like:
Musescore (free), Sibelius, and Finale
The process of adding samples (to get sound) and editing the tracks, adding effects, is done in a DAW (digital audio workstation). These are almost never free, and the free ones are usually garbage. Popular DAWs: REAPER, Cubase, Ableton, FL Studio, etc.
Sound Libraries are libraries of samples, meaning you're actually getting the sound from there. Free sound libraries are usually trash, and the commercial ones can go up in price pretty quickly (top sound libraries can cost more than 10k US$), but someone of them sound very good.
However, like
@TheoAllen said, you can still make it without sound libraries, or free ones. The midi files without samples have a default sound (even if it's terrible). If you use Musescore, a free notation software, it does come with basic and free samples, but like I said, they can't compare with commercial sound libraries.
EDIT: Lol, I do like to make things complicated, but it's because I want to give all the necessary information that might be useful now and in the future.