I have a function $f(x)=h([g_1(x),~g_2(x),\ldots, g_k(x)])$ and I want to find $f''(x)$. To this end, first I have $$f'(x)=\nabla h([g_1(x),~g_2(x),\ldots, g_k(x)]) \left[ \begin{array}{c} g_1'(x) \\g_2'(x)\\ \vdots \\g_k'(x) \end{array} \right]$$ and I assume that $\mathbf{m}([g_1(x),~g_2(x)\cdots g_k(x)]) = \nabla h([g_1(x),~g_2(x)\cdots g_k(x)])$. Therefore, $$f''(x)=\frac{d}{dx}\left[\mathbf{m\cdot g'}\right]$$ where $\mathbf{g'}=\left[ \begin{array}{c} g_1'(x)\\g_2'(x)\\ \vdots \\g_k'(x) \end{array} \right]$. Using the product rule (please check my application of product rule is right or not? I used the product rule described in https://proofwiki.org/wiki/Derivative_of_Dot_Product_of_Vector-Valued_Functions)
$$f''(x)=\mathbf{m'\cdot g'}+\mathbf{m\cdot g''}$$ Now the $\mathbf{m'}$ should be $\mathbf{m'}=\mathbf{g'^T}\nabla h^2([g_1(x),~g_2(x),\cdot, g_k(x)])$. But I do not know how this is true. any help in this regard will be much appreciated. Thanks in advance.
It's just a repeated application of the chainrule. After the first differentiation you have $$\nabla h \cdot \mathbf{g'}$$ And after the second: $$(\nabla h)'\cdot \mathbf{g'} + \nabla h \cdot \mathbf{g''}$$ Note that $\nabla h$ is a vector that depends on $x$ only via the vector $\mathbf{g}$. That means that to calculate its derivative w.r.t $x$, we need to differentiate it once again w.r.t. $\mathbf{g}$ (take its gradient once again, obtaining the hessian matrix $\nabla\nabla h$) and then dot that gradient with $\mathbf{g'}$ from the left (because it is already dotted with a $\mathbf{g'}$ from the right).
$$(\nabla h)'\cdot\mathbf{g'} = (\mathbf{g'}\cdot\nabla\nabla h)\cdot\mathbf{g'}$$
But that "dot from the left" is nothing but the matrix multiplication with $\mathbf{g'^{T}}$.
You can see this easily using index notation.
$$f(x) = h(\mathbf{g}(x))$$ Then aplying the chain rule once we get \begin{align} \frac{df}{dx}(x) &= \frac{\partial h}{\partial g^{i}}(\mathbf{g}(x))\frac{d g^{i}}{dx}(x)\\ f'&=\nabla h \cdot \mathbf{g'} \end{align} For the second derivative of $f$ we use the product rule, which you correctly did. \begin{align} \frac{d^2f}{dx^2}(x) &= \left(\frac{d}{dx}\frac{\partial h}{\partial g^{i}}\right)(\mathbf{g}(x))\frac{d g^{i}}{dx}(x) + \frac{\partial h}{\partial g^{i}}(\mathbf{g}(x))\frac{d^2 g^{i}}{dx^2}(x)\\ f''&=(\nabla h)'\cdot\mathbf{g'} + \nabla h \cdot \mathbf{g''} \end{align}
As we mentioned earlier, each $\frac{\partial h}{\partial g^{i}}$ depends on $x$ via $\mathbf{g}$, so in order to calculate its derivative w.r.t $x$ we will need to apply the chain rule once again. \begin{align} \left(\frac{d}{dx}\frac{\partial h}{\partial g^{i}}\right)(\mathbf{g}(x)) &= \frac{\partial^2 h}{\partial g^j \partial g^{i}}(\mathbf{g}(x))\frac{d g^{j}}{dx}(x)\\ (\nabla h)' &= \mathbf{g'^{T}}(\nabla\nabla h) \end{align}
Where $\displaystyle\frac{\partial^2 h}{\partial g^j \partial g^{i}}$ is the hessian $\nabla\nabla h$ (which you denoted by $\nabla h^{2}$). The expression $\displaystyle\frac{\partial^2 h}{\partial g^j \partial g^{i}}\frac{d g^{j}}{dx}$ corresponds to $\mathbf{g'^{T}}(\nabla\nabla h)$ because $\displaystyle\frac{d g^{j}}{dx}$ is contracted with the first index of the hessian.
Hence we have
\begin{align} \frac{d^2f}{dx^2}(x) &= \frac{\partial^2 h}{\partial g^j \partial g^{i}}(\mathbf{g}(x))\frac{d g^{j}}{dx}(x)\frac{d g^{i}}{dx}(x) + \frac{\partial h}{\partial g^{i}}(\mathbf{g}(x))\frac{d^2 g^{i}}{dx^2}(x)\\ f'' &= \mathbf{g'^{T}}(\nabla\nabla h)\mathbf{g'} + \nabla h \cdot \mathbf{g''} \end{align}