Why am I getting a syntax error when trying to create a stored procedure in MySQL?
If you want to create a stored procedure, you have to use the CREATE PROCEDURE syntax, see the documentation. You can't use procedural language constructs such as DECLARE in normal SQL. 

Also, you have to use the special delimiter you've declared after the final END, so the last line will be END\\. (And after that, don't forget to set DELIMITER back to ;, or you'll struggle.)

(There could be other problems as well, these are just two I spotted right away.)