A £19m government investment is expected to supply greener and more affordable low carbon heating for thousands of homes and buildings across the UK.