People wrote music all different ways, there was a composer who wrote an entire symphony based on the mountain ranges around him, Mozart rolled dice, and another fellow used I-ching coins. Writing music isn't too hard, for the counterpoint and harmony, but the melody is the hardest part which you will need.
And try not to listen to music as your composing. Start small with some simple waltzes, canons, then when that is mastered move onto minuets, vienese waltzes, and sonatas. Then from there concertoes, and quartets. Once you have mastered these try your hand at a couple symphonies, first f