Scotland’s prisoners achieved a total of 18,628 qualifications during the last full academic year, The Herald can exclusively reveal.