Bonds are originally sold so that entities can raise money to do various things that they need or want to do. Bonds are bought and sold on the secondary market as a way to invest money.
Bonds are typically sold by private companies and by government entities. In both cases, the purpose is to borrow money. When a bond is sold, the company or government entity gets money in exchange for the bond. The seller will have to pay money to the bond holder when the bond matures. In other words, the bond buyer is in essence loaning money to the bond seller in this original transaction. Therefore, we can see that the purpose of the original sale of a bond is so the seller can borrow money.
Once the bond is sold for the first time, it is typically sold and resold on the secondary market. This means that the person who bought the bond can sell it to another. People buy bonds as an investment strategy. Different bonds carry different levels of risk and reward. People buy bonds from government agencies so they can have a safe place to invest and get a little return. They might buy bonds from companies that are just getting started because those bonds have higher interest rates (although there is much more risk of default because the company might fail). In short, bonds are bought as a way to invest money, usually as part of a strategy where an investor buys some bonds and some stocks so as to be diversified.