Counterexample: In $\mathbb R^2,$ let $K=\\{(x,y):y>0\\},$ $M=\\{(x,x): x\in \mathbb R\\}.$ Let $f(x,y)=y.$ Then $f>0$ on $K.$ Suppose $g$ is linear and $g>0$ on $K$ and $g=f$ on $M.$ Because $g>0$ on $K,$ $g(x,y)=cy$ for some $c>0.$ Because $g=f$ on $M,$ we have $g(1,1)=c=f(1,1)=1.$ Therefore $c=1,$ hence $g=f$ everywhere.