O&D (ie simple trip) traffic is much more profitable than connecting traffic for many reasons, including :
1. The market expects to pay pretty much the same for a journey of comparable length regardless of the airline's costs in providing it. Thus from London to Los Angeles is say £400 on BA. Edinburgh to Los Angeles also expects to pay about the same, although there is the extra connecting flight involved.
2. In this case there is then the accounting issue of how the fare is divided up between the two flights. Although it is just a back-office beancounting issue it still affects the perceived profitability of one or both sectors. In the above example BA split the revenue by mileage, so London to LAX gets £350 (pretty much the fare from London anyway) and Edinburgh to London gets £50 (way less than the normal fare and a definite loss-maker for that route if considered in isolation). The internal arguuments about how you split up through fares between services with different managers has gone on as long as aviation has been around.
3. If the connecting flight is at a disadvantage compared to a competitor's direct flight the fare might even need to be offered at a discount. For example if there was a competing carrier offering nonstop Edinburgh to LAX at £400, BA might have to pitch their fare at only £300-350 to get any business connecting via London, despite their extra costs in doing so.
4. Not only is this connecting traffic charged at a low rate, but the connecting logistics, like here, may mean the passenger needs to be accommodated on a morning peak flight from Edinburgh to London where normally full fares are charged.
5. There are significant extra costs involved in the transfer. For example a proportion of connections will be missed and the airline will have to foot the bill for any extra costs. These will maybe run to overnight accommodation if the flight being connected into was the last of the day, or only runs once a day. This all has to be picked up in the costings.
6. Transfer connections multiply greatly the chances of misrouted baggage. The cost of repatriating mishandled baggage is a substantial extra cost, it is the key reason why airlines increasingly will not offer through baggage service if they can avoid it (eg trip on two separate tickets even on the same carrier).
Many connections are between different carriers, but the same considerations apply.