Thousands of people have been displaced after a fire destroyed around 1,000 homes in Malaysia's Sabah state.