I am assuming that you want a continuous piecewise linear fit of the form $ a(x-\xi)+c\hbox{ if }x\le\xi,\quad b(x-\xi)+c\hbox{ if }x>\xi. $ There are 4 variables to determine: the slopes $a$, $b$, the point $\xi$ and $c$, the ordinate at $\xi$. Let $\{(x_i,y_i)\}$, $1\le i\le N$, be your data. For simplicity I will assume that $x_i. For each $i=1,\dots,N-1$ minimize the expression $ O_i=\sum_{j=1}^i(y_j-a(x_j-\xi)-c)^2+\sum_{j=i+1}^N(y_j-b(x_j-\xi)-c)^2. $ This can be done by solving the system of 4 equations with 4 unknowns $ \frac{\partial O_i}{\partial a}=\frac{\partial O_i}{\partial b}=\frac{\partial O_i}{\partial c}=\frac{\partial O_i}{\partial \xi}=0. $ (This will be nonlinear, and will have more than one solution)
Finally, choose the index $i$ that gives the minimum $O_i$.
I tried this in a mock example, and it came out quite right.