The number of apprentices in Scotland has increased with more than 25,000 people starting training in each of the last two years, despite a challenging labour market.