Legal bid to end B&B ordeal for homeless Scots