This is Proposition 2.29 from the book Locally Presentable and Accessible Categories by Jiří Adámek and Jiří Rosický.
Above is a proof that $\lambda$-pure morphisms in $\lambda$-accessible categories are monos. It is unclear to me why do we create new $h$ instead of taking $\bar{v}$ in the line -4 and why such a $h$ exists in the canonical diagram of $B$ by the displayed line -5th?

The goal of the first part of the proof is to find a morphism of $\lambda$-presentable objects which coequalizes $p'$ and $q'$ to which to apply the assumption of purity on $f$. There is no reason why $\bar fp'$ should equal $\bar f q'$, so it would be useless to apply purity before constructing $h$. That said, the reason $h$ exists is that the canonical diagram of $B$ is filtered. We have parallel maps $\bar f p'$ and $\bar f q'$ in that diagram, and so there must exist a map $h$ in the diagram coequalizing them.