In the communist party, the head held absolute power and no one could challenge him. For example, under Brezhnev, he ruled even though he was physically quite old and incapable of looking after the country.
Leaders like Leonid Brezhnev, Yuri Andropov and Konstantin Chernenko used lot of resources and money of the country was diverted from producing goods for the population to producing arms and weapons to deal with the Cold War. For example, to enable rebels who wanted to overthrow the government and form a communist government in their countries, Russia had to supply money, arms and weapons for free. Also, to compete with the US and Europe in the nuclear arms race, Russia had to spend a lot of money on developing nuclear weapons. Since a lot of money from the government budget was spent on these items, the money available to spend on the general population's need was insufficient and also there was a shortage of goods used by the general population (cars, televisions, refrigerators, etc).
During World War II, the Russians overran the German troops on the eastern side of Germany and under agreement with England, they agreed to divide Germany into two parts. East Germany would be under Russian influence whereas West Germany would be under western influence. Similarly, the capital, Berlin, was divided into two parts: East Berlin and West Berlin. The Berlin Wall was then build to prevent people from East Germany to West Germany. The communist leaders did not want to admit that capitalism was superior to communism. In the absence of the Berlin Wall, people from East Germany would have escaped to West Germany. Thereby showing that the people did not want communism. At the end of the Cold War, when Gorbachov saw the benefits of capitalism, he withdrew his army from East Germany. When the people of East Germany saw this, they realized that they were now free and started to escape to West Germany. Soon the wall became redundant as lots of people left East Germany. So the wall was broken down.