Either way can work.
The heel-to-tip sweeping passes more closely replicate the motion most will use, if freehanding on stones. This is likely what most will do in fairly light touchup sharpening of any kind. And it's also what will leave the overall appearance of the edge bevels more uniform & clean-looking.
The back & forth motion, perpendicular to the knife edge, will also work. But one has to be careful not to linger too long in one portion of the edge, doing it this way. It can overgrind one portion, leaving a recurve in a section, or worse, leaving deep grooves & gouges in parts of the edge, created by the edges of the stones. If using this method, keep an eye open for these things and keep your touch light. If a lot of grinding needs to be done to set new geometry, this method might be used to focus on portions of the edge needing the most attention. But for finishing up & refining, I'd still recommend the smooth & light heel-to-tip passes, to clean up and blend the scratch patterns along the full length of the bevels.
IF YOU WANT TO, the perpendicular method can be used in refinement, to leave a scratch pattern that's oriented more perpendicular to the edge. For aggressive slicing cuts at a relatively toothy finish, this can work well. There are subtle differences in how such grind orientations cut and you can fine-tune your edges to suit your preferences in this manner. But that's something that's probably better done after you've gained some sharpening experience and better understand the pros & cons of different grind orientations along the edge.
I learned the fundamentals using a Lansky kit of this kind. So the above points are what I consider important as the takeaway, in using it.