Proceeds from a coal mine sale will be used to pump cash into the troubled Whyalla steelworks in a major debt deal.