how about at the end of the loop:
beginning_payment = ending_payment
Just overwrite the value of the beginning with the current ending.
If you need the starting balance at the end of your programm, then just introduce a new variable and write the amount in there.
Pseudocode would be somtehing like this
1 2 3 4 5 6 7 8 9
enter LOAN
make beginning = loan
loop while(beginning>0)
{
calculate interest, payment, new balance using beginning as a base
print out beginning, interest, payment, new balance
override beginning with new balance
}