David really wanted to build the temple for God but god didn’t allow him to build it. Instead he allowed Solomon to build the temple. I believe there were a couple of reason why God didn’t allow David to build a temple for him. The first reason why he didn’t allow David to build his temple is because he killed an innocent man because we wanted his to hide his sin with Bathsheba . But also after he had him killed he tried to hide it which was not very wise for him to do. The second reason why he didn’t allow David to build the temple is because he held the first census to count all of the people of Isreal. God didn’t want David to do this but he went against his will and did it anyway. And I believe the third reason why he didn’t want David to build the temple is because he wanted to pass it down to the next generation so they could carry it on.