The King's Own Scottish Borderers have marched as a regiment for the final time in their 317-year history.