For our convenience, the output of first NAND gate is chosen as X as shown,
Output is first NAND gate. X=A⋅B
Using De-Morgan's theorem, A.B=Aˉ+Bˉ
So X=Aˉ+Bˉ
Now, output of 2nd NAND gate, Y=Xˉ=Aˉ+Bˉ
againAˉ+Bˉ=Aˉ⋅Bˉ=A⋅B(∵Aˉ=A)
Hence, Y=A⋅B
This is the logic function of AND aate.