Flow Box Theorem
If $M$ is a manifold of dimension $n$ and $X$ is a vector field on $M$ such that for a certain $p\in M$ $X(p)\neq0$, then there exists a chart $(U,\phi)$ on $M$ such that $p\in U$ and $\phi_\ast X$, the pushforward of $X$ by $\phi$ is the first canonical vector.
The proof I have of this result starts by completing $X(p)$ to a basis $\{X(p),v_2,\dotsc,v_n\}$ of the tangent space $T_pM$. Then it fixes a function $g:\mathbb{R}^{n-1}\to M$ such that $g(0)=p$ and $\mathrm{d}g_0(e_{i-1})=v_i$ for $i\geq2$. From that function $g$, by composing it with the flow of $X$, it constructs a chart and then checks it is the chart the theorem states to exist.
I am not asking about the details of the proof, which I have sketched above, and which I am clear about. What I would like to know is how to prove such a function exists. This point was left to us students as an exercise, but I really do not know how to start on this. I mean, I can easily imagine a smooth $g$ such that $g(0)=p$: I just need a map taking $p$ as a value, then I compose it with a translation of $\mathbb{R}$. But how do I fix the differential? I would need to make sure $\frac{\partial(g \circ h)}{\partial x^{i-1}}=v_i(h)$ for any smooth map $h:M\to\mathbb{R}$… any help?