It's a bit hard to comment on this because the AD2 file won't download. All I get is a 1x1 gif image. However looking at K-Mod alone gives a strong pointer towards what the problem is.
I looked at the function in K-Mod and it looks to me like a merge is not possible, at least in the sense that most people use the word merge. Usually merging is about getting a function to also do A and perhaps some other mod wants it to do B and you can then just add A and B. That's not even remotely possible here.
Here the problem is that the two mods changes behavior of a vanilla function, meaning instead of vanilla, it does A. Then you can't add the other mod because the recipe for that one is "instead of vanilla, do B". You can't replace the vanilla behavior with A and B at the same time.
Let's make a simple example to display the type of issue you seem to have here. Say we have two mods, which alters the cost of hurrying building a unit. They both alter the very same code and if you just add one to the end of the other, it ends up with a cost of A and then it cost B, meaning you suddenly pay twice, which is not the intended goal. You can't just put the mods together and expect them to work together in such as case.
I fear the only solution is to take a step backwards and think about this. What is it that you want the function to do? Can you get away with just using the code from one mod? If you really need some code from both mods, then be prepared to program and you will have to consider how to merge them. Essentially you will end up programming a new mod, which is not just the sum of two mods, but with something none of those two mods have.
The quality of my answer would be better if I had seen the code for both mods, but the answer would still be the same: the solution is real programming, code design and considerations of a behavioral goal, not the copy paste you usually do when you merge mods.
Last, I will add the note that games which can load multiple mods at the same time would not be able to solve this problem. In fact when they run into problems like this, the two mods would list each other as incompatible because loading both would break one or both of them. It's not a problem due to only being able to load one mod at the time. It's a true code design conflict. In fact the odds of fixing it is better because it's a merge and not loading multiple mods.