You need to find out the publisher of each song, and pay them a "mechanical royalty" to record the song. The fee is standardized, and is less than $.10 per song, per copy you print. If your CD has 10 songs, you will typically pay a little bit less than a dollar a copy for the license to all of the songs.
Many times you can find the song info from the Harry Fox agency, which is a clearing house for many, but sometimes not all of the songs you need. If they have an affiliation with the publisher of the song, they can take care of it for you, which is great. If not, you may need to contact the publisher yourself.
www.harryfox.com
Try the link called "HFA songfile" if you're going to print less than 2500 CDs.
There's also a lot of good information on their website about how it works.