It says that Hashem looked in Torah and then He created the world so why did hashem look in Torah, if he knew what he wrote why does he have to look in it, did G-d forget what he wrote?
The idea is only that the Torah was the tool by which the world was created.
Hashem “looked in the Torah and created the world,” meaning that the Torah was the tool for the creation. See Mishlei 8:30.
In general, the Torah, and Chazal, use human terminology with reference to Hashem. Hashem didn’t actually “look” at the Torah, but rather created the world based on the Torah.