You should maintain separate counters for how many elements you have processed from each array. Once you reach the end of either of them, just copy the remaining elements from the other. Also note if elements are equal you don't copy but you should.
i = j = k = 0;
while(i < length1 && j < length2)
{
switch(compare(src1[i], src2[j]))
{
case -1: // src1 is less, copy it
dst[k++] = src1[i++];
break;
case 0: // equal, copy src2 but also increment i
i++;
// fall-through
case 1: // src2 is less, copy it
dst[k++] = src2[j++];
}
}
// at this point we have reached the end of one of the arrays
// just copy remaining elements
// note only one of these loops will do anything
while(i < length1)
{
dst[k++] = src1[i++];
}
while(j < length2)
{
dst[k++] = src2[j++];
}