The idiom "the word of Yahweh came to" is used to introduce a special message from God. Alternate translation: "Yahweh gave a message to Nathan. He said," or "Yahweh spoke this message to Nathan:" (See: [[rc://en/ta/man/translate/figs-idiom]])
Yahweh uses a question to emphasize that David is not the one to build a house for Yahweh. This question can be translated as a statement. Alternate translation: "You will not build a house for me" (See: [[rc://en/ta/man/translate/figs-rquestion]])
Here "house" means a temple. In 7:11 Yahweh will say that he will build a house for David. There "house" means a family. If your language has a word that can express both ideas, use it here and in 7:11.