Yes писать is a right word, because you write down the notes to the paper. If you compose music then say - Я сочиняю музыку.
Я музыкант, и кое-что сочиняю сам - I am a musician? and even compose...