how to create a different colored compound path in illustrator?
I have created many shapes with different colors when i tried to convert it into a compound path all the path converted into a single color.
How can I do that with compound path or some other tool?
You can't. A compound path is treated as one single path, that's the whole point of a a compound path.
Any fill, stroke, effect or anything applied to your compound path is applied to the whole compound path, not just one sub path.
If you want to color part of your compound path differently you will need to duplicate the parts you want to color as new paths... But then you may as well not bother converting it to a compound path in the first place.