The data on the average length of custodial sentence for every offence given by every magistrate court in England and Wales is not produced or published. The Ministry of Justice analyses court performance and custodial sentence lengths in other ways.
Magistrates’ Court data, for period ending December 2016 is published at https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/614427/magistrates-court-tool-2016.xlsx
The most recent figures (year ending September 2017) for average custodial sentence length by offence type can be found here: https://www.gov.uk/government/statistics/criminal-justice-system-statistics-quarterly-september-2017
Please see overview table 5.2c (this table covers both magistrates’ and Crown Courts).