It always puts in the last variable defined. You’ll need an if-statement telling the expression when to activate which variable.
a = [100, 500];
b= [1000, 500];
AB = linear(time, 0, 3, a, b);
BA = linear(time, 3, 6, b, a);
if (time<3) {AB} else {BA};