I read about many types of aircraft wing configurations like rectangular, swept forward, swept backword, and Delta wing. These configurations have their own advantages and disadvantages. But why we don't have variable sweep wing so that we can gain the advantages and better efficiency.
This was, as you are likely aware, the swing-wing was a major design element in the 1960s. Everything from the F-111 to the B-1 to the 2707 used them.
The design does have the advantages claimed for it, notably the better performance over a wider performance envelope. But the weight was a killer - not directly (although that may be the case in the 2707) but in relative terms.
Invariably what happened was that other parts of the system were improving too, engines, avionics, etc. At some point the performance improvement of the swing-wing required more weight than the same improvement from a new engine.
So it's not simply that it was too heavy, but too heavy compared to other moving goalposts.
Variable sweep is the best option when the top design speed is above Mach 2. If the speed requirement is reduced, a fixed, swept wing will be the better compromise, because it is lighter and less complex.
The quest for ever higher speeds made swing wings popular in the early Sixties, when engine performance, materials and engineering knowledge allowed to design aircraft which could operate at Mach 2+. Once the military analysts realised that this high speed was not needed, the swing wing quickly went out of fashion.