The first thing that you need to understand is that HDL is not a programming language; it is a
Hardware
Description
Language. It describes the connections of wires in a circuit diagram.
When you write something like
Part1(..., out=w);
Part2(a=w, b=w, ...);
you are describing a wire that connects from the output of Part1 to both input A and input B of Part2.
In your case, since you have already written your Not gate, you should use it as the second part in your And, rather than using 2 Nand gates.
This is why you should make and test the parts in the order that they are presented in the book. Each part you make can use the earlier parts as building blocks. Some of the parts you will make would require hundreds of Nand gates it that was the only kind of gate you used.
--Mark