Your cat is trying to tell you something by going to the bathroom outside the litter box. Have your cat checked for hyperthyroid. If he is eating well and has runny stool, this could be a sign. Also, hyperthyroidism is very common as cats age and can be controlled by meds. This disease can very serious (long term) as it effects the heart.
Good luck and hope you find an answer.
Good luck and hope you find an answer.