There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.
To solve your problem you have to separate your statements using different steps, batches, or transactions. it seems that you are trying to backup and alter the database in the same batch, statement, or transaction. Both operations are not allowed in a single statement or transaction.