Usually, you keep people (particularly children) in line - meaning ensure they behave as expected. When used with concepts other than people, you often see "in line with" - the earning reports were in line with predictions - they were even with, or what you would expect. In your case, I think it means keeping my grades up - not necessarily all top marks, but all good marks.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.