This is the third of the three words in the title, although I have taken them out of order. What is thinking, for Heidegger, and what does it have to do with either dwelling or building?
Heidegger says this:
But if we listen to what language says in the word bauen we hear three things:
...We do not dwell because we have built, but we build and have built because we dwell, that is, because we are dwellers.
Heidegger, "Building Dwelling Thinking"
So, we build because we dwell. But where's the thinking? For Heidegger, thinking refers to the ability to truly know ourselves as ourselves, and put our self-knowledge into practice. That knowledge is not just intellectual reflection, but our recognition that we think just by being in the world.
In other words, true dwelling is thinking. We bring a set of possibilities into reality, both for ourselves and our world. But, we don't force our world into a pre-determined form (like the dam). We allow the world to ask us, "Who are you?", we don't just ask the world "What can you do for me?"
Only if we are capable of dwelling, only then can we build. Let us think for a while of a farmhouse in the Black Forest, which was built some two hundred years ago by the dwelling of peasants. Here the self-sufficiency of the power to let earth and heaven, divinities and mortals enter in simple oneness into things, ordered the house. It placed the farm on the wind-sheltered mountain slope looking south, among the meadows close to the spring. It gave it the wide overhanging shingle roof whose proper slope bears up under the burden of snow, and which, reaching deep down, shields the chambers against the storms of the long winter nights. It did not forget the altar corner behind the community table; it made room in its chamber for the hallowed places of childbed and the "tree of the dead" - for that is what they call a coffin there: the Totenbaum -- and in this way it designed for the different generations under one roof the character of their journey through time. A craft which, itself sprung from dwelling, still uses its tools and frames as things, built the farmhouse.
Only if we are capable of dwelling, only then can we build. Our reference to the Black Forest farm in no way means that we should or could go back to building such houses; rather, it illustrates by a dwelling that has been how it was able to build.
Heidegger, "Building, Dwelling, Thinking"