Let $G$ be a lie group. Assume that $B$ is the Killing form of its Lie algebra $T_{e}G$. So $B$ is counted as a symmetric $2$-form on $G$ by translation.
Is there a smooth function $f$ on $G$ which Hessian is equal to $B$?
The Hessian is considered with respect to the $LC$ connection associated to an invariant metric.
This is impossible at least if $G$ is compact and non-abelian (or a product of such group with something else). On the other hand, if $G=\mathbb R^n$ (or $\mathbb R^n/\mathbb Z^n$), then the Killing form vanishes identically and any constant or linear function satisfies the desired property. I don't have a complete answer, but let me explain why it fails for these compact groups.
A compact Lie group is a product of a torus with a compact group with negative definite Killing form; this follows from the classification of compact Lie groups. That is, $G=\mathbb T^n\times K$ for some compact group $K$. We can restrict our function $f$ to the submanifold $K$ and the key property remains: the Hessian equals the Killing form.
Now we are on a compact group $K$ where the Killing form is negative definite. There is a non-trivial Lie homomorphism $\phi:S^1\to K$ from the circle group because one can always embed a torus of some dimension in a compact group. Let $f\in C^2(K)$ be such a function that the Hessian $H(f)$ is negative definite. (The same argument goes through with positive definiteness as well.) Therefore $$ (f\circ\phi)''(t) = H(f)(\phi'(t),\phi'(t)) < 0 $$ for all $t\in S^1$. But $(f\circ\phi)'$ is a $C^1$ function $S^1\to\mathbb R$, so (after applying the fundamental theorem of calculus around the loop), we have $$ \int_{S^1}(f\circ\phi)''(t)dt=0. $$ This is in contradiction with $(f\circ\phi)''$ being always negative.