how can this function be computed in polynomial time in regards to its input?
Let's start with solving the problem for 1-CNFs. The proof will be by example. If the truth assignment is $x_1=x_2=1,x_3=0$ then a 1-CNF for which this is the only satisfying assignment is
$$
x_1 \land x_2 \land \overline{x_3}.
$$
Now let's solve the problem for 2-CNFs, again by example. Continuing with our previous example, here is one possible construction:
$$
(x_1 \lor x_2) \land (x_1 \lor \overline{x_2}) \land
(x_2 \lor x_3) \land (x_2 \lor \overline{x_3}) \land
(\overline{x_3} \lor x_1) \land (\overline{x_3} \lor \overline{x_1}).
$$
More generally, we replace $x_i$ with $(x_i \lor x_j) \land (x_i \lor \overline{x_j})$ for an arbitrary $j \neq i$.

Your problem can be solved in a very similar way.