There is a triangle having two sides $ax^2 +2hxy +by^2 = 0$ and orthocenter $(p, q)$. Find the equation of other side.
I first let the sides are $OM$: $y = m_1x$ and $ON:$ $y = m_2x$. Where $m_1m_2= \frac{-2h}{b}$ and $m_1 + m_2 = \frac{a}{b}$
Then I found the foot of the perpendicular of $(p, q)$ on $OM$. It was $$Q\left(\frac{p-m_1q}{m_1^2 + 1},m_1\frac{p-m_1q}{m_1^2 + 1}\right) $$
Now $Q$ is the midpoint of $O$ and $M$. Thus I got $M$ is $$\left(2\frac{p-m_1q}{m_1^2 + 1},2m_1\frac{p-m_1q}{m_1^2 + 1} \right)$$
Similarly, N is $$\left(2\frac{p-m_2q}{m_2^2 + 1} ,2m_2\frac{p-m_2q}{m_2^2 + 1} \right)$$
Using two point formula and making some manipulation, the equation of line $MN $ i.e. the third side became
$$\frac{(m_1^2 + 1)y- 2m_1p+2m_1^2q}{(m_1^2 + 1)x- 2p+2m_1q} =\frac{m_1m_2p}{(m_1+m_2)p+q}$$
From now where to go ?
Your method is incorrect. The orthocenter is simply the intersection of altitudes. It has nothing to do with midpoints.
Denote $H(p,q)$ as the orthocenter. The triangle is $\triangle OMN$. Then
What you should do
Find one of the altitudes, let's say $HN$, by making the line through $H$ with slope $-1/m_2$ (from the slope of $OM$). $Q$ is indeed the intersection of $HN$ and $OM$, but it is not the midpoint of $OM$
Find $N$ is by intersecting $HN$ with $ON$.
Find $M$ in the same way. Once you have $M$ and $N$, find the line through them. You result should contain $p,q,m_1,m_2$ as these are all known constants.
Alternatively, You can find $MN$ without finding both points. After finding $N$