"Why did he lie in the first place?"
Maybe he was told that Mueller would be fired and an investigation would be stopped. So why not lie so there is nothing on the record to justify that investigation, or a new one….
(Edited to reflect @jakebarnes correction re: Mueller hiring)