Linear regression question

So given a data which includes two different populations (which are different sizes) I need to fit a line in between and than based on that line I’m trying to use ‘switch’ to assign the data to either a top fitted line of a bottom fitted line and I super lost. Any advise would be appreciated!!