With so little data there could be many answers, but here’s a simple method using a system of equations. The relation between temperature T and time t is not linear because the temperature rises then falls. We are going to create a quadratic function which has 3 coefficients a, b, c. We have three pairs of data so we use these to find the 3 coefficients using 3 simultaneous equations.
T=at²+bt+c.
When t=2, T=5:
(1) 4a+2b+c=5;
When t=4, T=8:
(2) 16a+4b+c=8;
When t=6, T=7:
(3) 36a+6b+c=7.
Subtract (1) from (2) to eliminate c:
(4) 12a+2b=3;
Subtract (1) from (3):
(5) 32a+4b=2.
So now we have 2 equations and 2 unknowns.
Double (4): 24a+4b=6 and subtract this from (5):
8a=-4, a=-½. So from (4): -6+2b=3, 2b=9, b=9/2.
Substitute a=-½, b=9/2 in any of the original equations. Let’s pick (1):
-2+9+c=5, c=5+2-9=-2.
So T=-t²/2+9t/2-2 is the formula.