Good question Peter. As far as we know none of the authors of these documents claim that they were eye witnesses. None of them explain in detail how the got their information.
But could their have been a King named Gilgamesh, could he have secured lumber in the great forest of cedar, could he have been concerned about what happens after he dies? Certainly.
I look at it as hortatory, thought provoking literature, but, do real people write real literature? They certainly do IMO!