You could manually calculate the new balance each year and get to the answer of course:

A = ((25000(1+(0.04)/1)^(1*1))-25000)*.07)+25000

and then take the balance and replace the original principle and do the calculation over 39 more times. But, there must be a way to create a function or a single calculation that gets you to the answer at 40 years?

Not sure if this does it (in terms of a graphable function):

y = (((25000(1+(0.04)/1)^(1*x))-25000)*.07)+25000)(1+(0.04)/1)^(1*x)