Thanks for the reply, Dan.
I think that there are some terms missing - and those are the ones that I am having problems generating. Here are the terms that I was aiming for, with the missing ones that I cannot seem to create in blue:
1,
x1, x2, x3,
x1^2, x2^2, x3^2, x1x2, x1x3, x2x3
x1^3,x2^3, x3^3, x1x2x3, x1x2^2, x1x3^2, x2x1^2, x2x3^2, x3x1^2, x3x2^2
Thanks for your help.