Two bonds with the same credit rating but different maturities will have different yields. Why?
Well, unsurprisingly, we are back to the basic risk/return relationship again i.e. the greater the risk, the higher the return needed to compensate for that risk.
We have already said that our two bonds have the same credit risk but, as we have seen, credit risk is not the only risk faced by a bondholder, and our other risks interest rate risk, reinvestment risk, event risk and so on are higher for long-tem bonds than short-term bonds, because they have more time to actually occur.
This basic principle of risk and return gives a distribution of return (yield) against maturity called the yield curve (or the term structure of interest rates), which, under normal circumstances, is shaped like this.