The Scottish Government has been accused of presiding over “disgraceful” waits in temporary housing after figures revealed people are waiting years for a permanent home.