Scotland generated a record amount of energy from renewables last year – with data also showing the electricity generated north of the border helped power the rest of the UK.