I had learnt the Bézout's identity in which it stated that
For nonzero integers $a$ and $b$, let $d$ be the greatest common divisor $d = gcd(a, b)$. Then there exists integers $x$ and $y$ such that $$ d = ax + by $$
Now we could transform this into
$$ d = ax + 1 \cdot (by) $$ which is $$ d = gcd(a, 1) $$ Which is wrong as this would mean all the $gcd$s would be equal to $1$.
So can anyone tell me the correct way to manipulate Bézout's identity?
It is true that, if $d=\gcd(a,b),$ then there are integers $x$ and $y$ such that $d=ax+by.$
The converse is not true. It is not true that, if there are integers $x$ and $y$ such that $d=ax+by,$ then $d=\gcd(a,b).$ Thus your assertion after "which is" is a non sequitur.
What is true: if there are integers $x$ and $y$ such that $d=ax+by,$ and $d$ divides $a$ and $d$ divides $b,$ then $d=\gcd(a,b).$