I am curious to know how the technology was lost. If it has been built, it can be built again, can’t it? What exactly is the problem?

Lose it? We never lost it. If anything we have much, much more technology now than ever.
What we lost was the will to go to a deserted rock in a vacuum. It has no value to go there. Why should we keep spending the money?
Back then it was a matter of national pride and a race to space against the Russians. Now we’ve been there, done that, left some experiments we can still use from here, and decided to yield to Congress and pay for Vietnam and other wars rather than fund useless trips to the moon. More “bang” for your bucks, so to speak.