Scotland will establish a publicly-owned, not-for-profit company by the end of the current parliamentary term in 2021 to provide locally-generated renewable energy to customers “as close to cost price as possible”.