Transforming Line Equations Between Viewports

Hi, I am working on a project that enables to
find corresponding points in two different
view ports. Frist I get the world coordinates
of the point that I need in the first view port, then I find an equation of the ray because I know the coordiantes of the camera and the world coordinates of the point. I have two questions. First is, if I have 2 points, what is the most efficeint way to calculate the equation of the line that goes through those points? Assuming that I find the equation, how would I transfer the equation into another viewport? thanks,