We can find the answers by using the recurrence equation for a loan.
Where
p[n] is the balance of the loan in month n
r[n] is the interest rate in month n
d is the regular monthly payment
s is the initial loan principal
using Mathematica
RSolve[{p[n + 1] == p[n] (1 + r[n + 1]) - d, p[0] == s}, p[n], n]
yields

Defining the rates
rates = Join[
ConstantArray[(1 + 0.05)^(1/12) - 1, 60],
ConstantArray[(1 + 0.06)^(1/12) - 1, 60],
ConstantArray[(1 + 0.07)^(1/12) - 1, 120]];
Array[(r[#] = rates[[#]]) &, 240];
so the following variables are now defined
r[1], r[2] etc. = 0.0040741237836483535
r[61], r[62] etc. = 0.004867550565343048
r[121], r[122] etc. = 0.005654145387405274
Setting p[0] = s
.
The balance in month 240 is
p[240]
-486.25993004513117 d + 3.3598013365663992 s
and should equal zero.
The capital repayment in month 122 is the repayment less monthly interest
d - (p[121] r[122])
d - 0.005654145387405274 (-162.14186160490192 d + 1.7176096436481687 s)
This is required to equal 1,766.13
Solving simultaneously
NSolve[{
-486.25993004513117 d + 3.3598013365663992 s == 0,
d - 0.005654145387405274 (-162.14186160490192 d + 1.7176096436481687 s) == 1766.13},
{s, d}]
{{s -> 499996.1740005939, d -> 3454.7115850762493}}
Calculating the interest for the last 12 months, using inputs to 2 decimal places.
s = 499996.17
d = 3454.71
Total[p[# - 1] r[#] & /@ Range[240 - 12, 240]]
1728.46