Millions of pounds are to be spent on helping families move out of temporary accommodation in Gloucestershire.