Hmm, it works fine for me generally, but when I tested with the mortar group placed on steep rough terrain, the formation they took was so close together that they blew each other up when the second one fired a round (the second and third were both in exactly the same position! Thus, manually check where they end up getting placed and consider using a formation "NONE" for each of them so you can have complete control over their placement!!!
Remember that it takes about 20 seconds before the mission is over when I tested firing from one end of utes to the other with mortars. Other ranges and weapons could be very different.
Incidentally, don't use _x as the iterator in a for loop. _x is a special system variable used in forEach loops. Works fine, I'm sure, but not good practice.
Haven't time to test it, but start with something like:
// From editor:
// call { [battery, mytarget, 45, 100, 10] execVM "creep.sqf"; }
_art = _this select 0;
_tar = _this select 1; // Object or position of centre of line.
_dir = _this select 2; // Direction of creep.
_length = _this select 3;
_spacing = _this select 4;
_centre = if (isObject _tar) then { getPos _tar } else { _tar };
for "_offset" from -(_length / 2) to +(_length / 2) step _spacing do
{
_pos = [(_centre select 0) + ((sin _dir) * _offset),
(_centre select 1) + ((cos _dir) * _offset),
(_centre select 2)];
[_art, _pos, ["IMMEDIATE", "HE", 0, 3]] call BIS_ARTY_F_ExecuteTemplateMission;
waitUntil { [_art] call BIS_ARTY_F_Available };
};