Error 1064 - You have an error in your SQL syntax;
The syntax is not:

SELECT id INTO @x, data INTO @y ...


but it is:

SELECT id, data INTO @x, @y ...


Use:

SELECT SUM(avg_score), COUNT(Id)
  INTO averageScore, IdCount
FROM ... ;