There is nothing quite like composing your own music. Whether you're composing purely as a hobby, as a semi-professional, or as a means of making an income, there is always a degree of satisfaction at the completion of each musical work.
If you're composing music merely to entertain yourself and your friends that's fine. However if you wish to derive some revenue from your composition, then you need to register your work with an agency who look after and protect musical pieces. Each country has its own entities who do this. Once you have written a piece of music, whether complete or unfinished, you have created not only a music work, but a copyright in that music. That means that no-one has the right to copy that music without your permission to do so. You need to register the music with an agency whose job is safeguarding your intelectual property. Some charge a small fee per composition to do this, while larger organisations, i.e. ASCAP and BMI in the USA, APRA in Australia, and MCPS in the UK will look after your copyright at no charge, providing you are a member of the organisation. Each of these latter entities have their own criteria on membership conditions. They will also collect any royalties earned from public performances of your music on your behalf.
In some jurisdictions it is accepted that if you mail a hard copy of your composition via the postal system addressed to yourself, then that can aid in proving ownership, providing it remains sealed. This can help in establishing that you wrote your piece before any other claimants to the music in the case of any ownership disputation. The legality of this is dependant upon your local laws.