1) I'm pretty sure you have that first one a little backwards. Perhaps x <= 2 or x >= 4?
2) It will help to separate the definition, so I'll use
f(x) = 3x-2
g(x) = x^2 + ax + b
We'll just use g(x) when we are around x = 3 and g(x) when one (1) or more away.
Your task is to create a continuous function. The only trick is matching up the endpoints, since (thankfully) they are the same).
f(2) = 4
f(4) = 10
We must make g(2) = 4 and g(4) = 10
That's all. Let's see what you get.