I understand how to perform a least means regression of a given set of $x$ points to approximate a line that best fits them. In this case I observe a set of $x$ inputs and y corresponding outputs. Then I can create$ a \hat y = m\hat x+ b$ which is a line that best fits the $x$ and $y$ I observed.
Now let's suppose that I do this experiment several times. Now I have a matrix of $X $observations and a matrix of Y corresponding outputs. How would I find the $\hat y = m\hat x+ b$ that best fits all observations?