It's important to note that:
* 2 ATP molecules are produced directly during glycolysis.
* 2 NADH molecules are produced as well, which will later be used in the electron transport chain to produce more ATP (a total of 6-8 ATP molecules, depending on the cell type).
So, while glycolysis itself only produces 2 ATP molecules, the NADH molecules it generates contribute to the overall ATP yield of cellular respiration.