List the prime factors of $a$ and/or $b$ as $p_1, p_2, .....,p_n$.
Let $a= \prod_{i=1}^n p_i^{k_i}$ for some non-negative integer values of $k_i$ (which may be equal to $0$). And let $b=\prod_{i=1}^n p_i^{j_i}$ for some non-negative integer values of $j_i$.
Then $\text{lcm}(a,b)= \prod_{i=1}^n p_i^{\max(k_i, j_i)}$. We can note that although $k_i$ may be $0$ and $j_i$ may be $0$, they can't be both be. And we can not that if $\max(k_i, j_i)=k_i$ then $p_i^{k_i}|a$. And if $\max(k_i, j_i)=j_i$ then $p_i^{j_i}|b$.
Now if we let $c = \prod_{i=1;k_i\ge j_i} p_i^{k_i} = \prod_{i=1;k_i\ge j_i} p_i^{\max(k_i,j_i)}$ and $d=\prod_{i=1;k_i< j_i} p_i^{j_i} = \prod_{i=1;k_i< j_i} p_i^{\max(k_i,j_i)}$ then:
$c|a$ and $d|b$.
$\gcd(c,d) =\prod_{i=1; k_i\ge j_i\text{ and }k_i < j_i} p_i^{\min(k_i, j_i} = \prod_{i=1; i\in \emptyset}^n p_i^{\min(k_i, j_i} = 1$.
$cd = \prod_{i=1;k_i\ge j_i} p_i^{\max(k_i,j_i)}\prod_{i=1;k_i< j_i} p_i^{\max(k_i,j_i)}=\prod_{i=1}^n p_i^{\max(k_i, j_i)}=\text{lcm}(a,b)$.
....
If that seems too abstract consider $a= 3^{17}5^47^{3}$ and $b=2^{6}3^{8}5^{9}$.
Then $a = 2^03^{17}5^47^3$ and $b=2^{6}3^85^87^0$.
And $\text{lcm}(a,b) = 2^{6}3^{17}5^97^3$.
$k_1=0< j_1=6$ so $2^6$ is a factor of $d$. $k_2=17>j_2=8$ so $3^{17}$ is a factor of $d$. And $k_3=4< j_3=9$ so $5^9$ is a factor of $d$. and $k_4=3>j_4 = 0$ so $7^3$ is a factor of $c$
So $c = 3^{17}7^3$ and $c|a$. And $d=2^65^9$ and $d|b$.
ANd $\gcd(c,d)= 1$ and $cd = 2^63^{17}5^97^3 = \text{lcm}(a,b)$.