There are a number of ways to set it up. This would probably be the most straightforward, brute-force method for the task as you’ve described it:
A = [0,0];
B = [500,200];
C = [1000,1000];
t1 = 0;
t2 = 2;
t3 = 4;
t4 = 6;
if (time < t3)
linear(time,t1,t2,A,B)
else
linear(time,t3,t4,B,C)