What's wrong with this procedure of finding Lorentz transformation equations? The velocity of light in vacuum is the same for all inertial observers. This means $$\frac{dx}{dt}=\frac{dx'}{dt'}=c\\
\Rightarrow {(c\,dt)}^2-dx^2=0={(c\,dt')}^2-{dx'}^2.$$
I think that without further work, it is not obvious that for arbitrary nonzero values of ${(c\,dt)}^2-dx^2$, the equality
$${(c\,dt)}^2-dx^2={(c\,dt')}^2-{dx'}^2$$
will hold true.
Given the postulate of the constancy of the speed of light, if we were to find how $(t,x)$ must transform, we can make use of the first equality only - a weaker condition than the second equality. But it is usually derived using the stronger condition (second equality) which assumes the equality for arbitrary values of ${(c\,dt)}^2-dx^2$.
If we strictly have to follow the postulate, IMO, we must derive the Lorentz transformation equations in two steps as follows.
Step 1. First, we assume
$$c\,t'=A\,c\,t+B\,x,\quad x'=K\,c\,t+D\,x.$$
Step 2 Then make use of two conditions ${(c\,dt')}^2-{dx'}^2=0$ and ${(c\,dt)}^2-dx^2=0$.
We start with
$${(c\,dt')}^2-{dx'}^2=0\\
\Rightarrow (A^2-K^2)\,c^2dt^2 + (B^2-D^2)\,dx^2 + 2(AB-KD)\,c\,dt\,dx=0$$
Now the only condition that we can use is $c\,dt=\pm dx$, which is insufficient to find all the four unknown constants.
Does this mean that one cannot derive the Lorentz transformation equations from the constancy of the speed of light only?
 A: Yes, the constancy of the speed of light is not sufficient.  You need additional assumptions. These notes by Victor Yakovenko provide a derivation of the general coordinate transformation
$$\pmatrix{x'\\t'}=\frac{1}{\sqrt{1+v^2/a}} \pmatrix{1 & -v\\v/a & 1}\pmatrix{x\\t}$$
where $a$ is some parameter with dimensions of velocity squared. This derivation makes the following assumptions:

*

*The coordinate transformation should be linear (you already assumed this in step 1)

*Space is isotropic, so e.g. the length of a moving ruler is the same if it's moving to the left as if it were moving to the right

*The composition of two transformations is another transformation

*Transformations depend only on the relative velocity between frames


This yields 3 viable possibilities.  Either $a>0$, $a<0$, or $a\rightarrow \infty$ (the latter case results in the Galilean transformations).  However, if we additionally demand that there exists an invariant speed $c$ such that objects moving with speed $c$ in one frame are moving with the same speed in every other frame, then the only possibility is that $a = -c^2 < 0$.
There are many routes to the Lorentz transformations which make different assumptions, but the point of my answer is that the assumption of the constancy of the speed of light is not sufficient all by itself.  There must be other (reasonable) physically-motivated assumptions about the structure and symmetries of spacetime to go along with it.
A: I have seen the Lorentz transformation derived in a very similar way you approached it:
Let me first rewrite your final equation without the differentials (there is little point in using these if the speed of light is assumed as constant)
$$(1)\:\:\:(A^2-K^2)c^2t^2 +(B^2-D^2)x^2 +2(AB-KD)ctx =0$$
If you subtract furthermore the equation $c^2t^2-x^2=0$ from this you get
$$(2)\:\:\:(A^2-K^2-1)c^2t^2 +(B^2-D^2+1)x^2 +2(AB-KD)ctx =0$$
If that is supposed to be true for all x at given t, each of the coefficients to the different powers of x have to be zero separately, so
$$(3)\:\:\:A^2-K^2-1=0$$
$$(4)\:\:\:B^2-D^2+1=0$$
$$(5)\:\:\:AB-KD=0$$
Now additionally you obviously have to use the constraint that the primed and unprimed frames are moving relatively to each other (after all, that is why we are doing this in the first place).
So the additional conditions we have are
$$(6)\:\:\:x'=0 => x=vt$$
$$(7)\:\:\:x=0 => x'=-vt$$
Inserting this into your transformation
$$(8)\:\:\:x'=Dx+Kct$$
$$(9)\:\:\:ct'=Act+Bx$$
yields then
$$(10)\:\:\:K=-\frac{v}{c}D$$
$$(11)\:\:\:A=D$$
$$(12)\:\:\:B=K$$
Inserting this into (3) and (5) yields
$$(13)\:\:\:D^2(1-\frac{v^2}{c^2})-1=0 => D=\sqrt{\frac{1}{1-\frac{v^2}{c^2}}}$$
$$(14)\:\:\:B=-\frac{v}{c}\sqrt{\frac{1}{1-\frac{v^2}{c^2}}}$$.

However, there is in my opinion a problem with this derivation:
The quadratic equations that lead to Eq.(1)
$$(15)\:\:\: x^2=c^2t^2   ;\:\:\: x'^2=c^2t'^2$$
have the solutions
$$(16)\:\:\: x_1=ct   ;\:\:\: x_1'=ct'$$
$$(17)\:\:\: x_2=-ct   ;\:\:\: x_2'=-ct'$$
so
$$(18)\:\:\: x_2= -x_1$$
$$(19)\:\:\: x_2'= -x_1'$$
We can rewrite the transformation (8) for the two solutions as
$$(20)\:\:\:x_1'=Dx_1+Kct$$
$$(21)\:\:\:x_2'=Dx_2+Kct$$
However, by inserting (18),(19) into (21) we get
$$(22)\:\:\:-x_1'=-Dx_1+Kct$$ i.e.
$$(23)\:\:\:x_1'=Dx_1-Kct$$
which is inconsistent with (20) unless $K=0$ i.e. unless $v=0$, which doesn't make any sense.
