why do they say that a building cannot be constructed if there was no friction and that a nail fixed on a wall is due to friction.
It is true. Friction, as we all know, is caused due to the interlocking of irregularities of the two surfaces in contact. If the interlocking of the surfaces of the brick and the ground was not there how could a building be constructed?it would not be staying in one place but rather get destroyed. And if friction wasn't there the nail would not get fixed to the wall as there won't be grip which the friction provides.
Hope this provides the answer for your question.