In this case, 4k - 2mk - 2c - 1 = m(-6k + 3mk + 3c + 4) + c or (4- 2m)k- (2c+1)= (-6m+ 3m^2)k+ (3mc+ 4m), A= 4-2m, B= -(2c+1), C= -6m+ 3m^2, and D= 3mc+4m. A= C gives 4- 2m,= -6m+3m^2 and B= D gives -(2c+1)= 3mc+4m.
(Strictly speaking, here they are using a variation of this: if Ax+ B= 0 for all x, then A= 0 and B= 0. Here, C= D= 0.)
More generally, if two polynomials are equal for all x then "corresponding coefficients", that is, coefficients of the same power of x, must be equal.