And how are these transaction fees determined within the lightning network?
All implementations use the following formula.
base fee + amount * (fee rate/1000000)
So, the bigger your payment is, the more you are going to pay. By default, the base fee is set to 1 satoshi and the fee rate to 1. Those two parameters can be different for each channel on both sides. Let's take a look at your example again.
A -> B -> C -> D
Even though B could have different fee settings for their channel with A and C, they would charge A only for using the outgoing channel. The same goes for C. A would pay the fee calculated from the settings set by C in their channel with D.