ok, first things first... you should really get to know KRL basics before writing KRL code.
for example:
1. variables can be declared in both SRC and DAT but that will determine their life, scope as well as ability to monitor them. don't have time to go in depth but you probably want to declare and initialize most of them in the DAT file.
2. things you marked as "globals" are not global at all, they are pure runtime variables (see begin of your SRC file). in KRL all globals MUST be declared in the DAT file. i would add they should also be initialized in the DAT file even if the value changes. this allows you to see last value after reboot for example. you can still override initial value in SRC if you need to.
3. variables declared in SRC need to be declared at the top of the file. but any user added initialization need to be either inside designated fold within INI... or... after INI. you ended setting orientation type before INI and of course it does not have any effect - because later on INI is executed and this resets all motion parameters. the same goes for other motion parameters including velocity and acceleration. you set those using FOR loop but this is completely useless since INI resets everything. even if you move this after INI fold it still would have no effect because most of your motions are inline form instructions and they are using everything local - position, speed, acceleration etc. Not just that. once the ILF motion is executed and all those parameters are set by it, all motion parameters keep the values until something else modifies them (tool, base, speed, accel, approximation etc.). so ILF motion to P4 sets everything not just for P4 but also for
PTP_REL {X 250, Y -1000, E1 300}
and
PTP_REL newLine
then once the PTP P6 is executed, all of the motions in your FOR loop will use the P6 settings. the only motion that will be different in final PTP HOME1
4. in KRL position data can be declared two ways - either in Cartesian or Axis form. home positions are in axis form. most other positions are Cartesian. Cartesian positions do define correct place and orientation of the TCP but to define robot arm pose one must also assign values to Status and Turn. Without those values specified, robot will try to figure out on its own what S and T values are to be used. And that is not something you want to leave for a brainless machine unless you really know what is going on.