Nicola Sturgeon says moving people from hospital to care homes at the start of the pandemic was an error.