Let $B$ be a vector bundle over a manifold $M$, $D$ be a connection on $B$, and $\nabla$ a torsion-free connection on the tangent bundle $T_*$. Given a section $f$ of $\mathrm{End}(B) = B\otimes B^*$ and a section $v$ of $B$, let $\langle f, v\rangle$ denote the section of $B$ obtained by evaluating $f$ at $v$.
Given a section $e$ of $\mathrm{End}(B)$ and vector fields $X$, $Y$, and $Z=[X,Y]$, let $E$ denote the section of $\mathrm{End}(B)$, where for any section $v$ of $B$, \begin{align*} \langle E, v\rangle &= D_X\langle e,D_Yv\rangle + D_Y\langle e,D_Xv\rangle - \langle e,D_Y(D_Xv)\rangle - D_X(D_Y\langle e, v\rangle)\\ &\quad- \langle e, D_Zv\rangle + D_Z\langle e, v\rangle\\ &= \langle D_Xe, D_Yv\rangle + \langle e, D_X(D_Yv)\rangle + \langle D_Ye, D_Xv\rangle + \langle e, D_Y(D_Xv)\rangle\\ &\quad- \langle e, D_Y(D_Xv)\rangle - D_X\langle D_Ye, v\rangle -D_X\langle e,D_Yv\rangle\\ &\quad- \langle e,D_Zv\rangle + D_Z\langle e, v\rangle\\ &= \langle D_Xe, D_Yv\rangle + \langle e, D_X(D_Yv)\rangle + \langle D_Ye, D_Xv\rangle\\ &\quad - \langle D_X(D_Ye), v\rangle - \langle D_Ye, D_Xv\rangle - \langle D_Xe, D_Yv\rangle - \langle e,D_X(D_Yv)\rangle\\ &\quad- \langle e, D_Zv\rangle + D_Z\langle e, v\rangle\\ &= -\langle D_X(D_Ye),v\rangle - \langle e, D_Zv\rangle + D_Z\langle e,v\rangle\\ &= -\langle D^2_{XY}e, v\rangle - \langle D_{\nabla_XY}e, v\rangle - \langle e, D_Zv\rangle + \langle D_Ze, v\rangle + \langle e, D_Zv\rangle\\ &= -\langle D^2_{XY}e, v\rangle - \langle D_{\nabla_XY}e, v\rangle + \langle D_Ze, v\rangle\\ &= -\langle D^2_{XY}e - D_{\nabla_YX}e, v\rangle. \end{align*} Therefore, $$ E = D^2_{XY}e - D_{\nabla_YX}e $$