Are the above sentences grammatically correct and do they make sense?
All the sentences are grammatical, but only the first two make sense. Sentences (c) and (d) are semantically infelicitous and therefore incorrect. You could fix (d) by changing "but" to "and" or by using as separate sentence.
(d1) I talked to the engineer who was to have fixed the system. He said he couldn't do it.
The perfective infinitive "was to have fixed" implies that he didn't actually do it. The second sentence now explains what happened: he wasn't able to fix the system. There is no contrast that would justify the use of "but."
In (c), "but he didn't do anything" is awkward and unclear. You could fix it by changing "but he didn't do anything" to "but hadn't." It's redundant to say "but hadn't," but you seem to want to continue the sentence.
(c2) He was the man who was to have solved the problem but hadn't.