Yes it was written by man, but inspired by God.
And many flaws, by today’s standards.
How can this be?
Well it’s like this.
You know Jewish people don’t pork, but did you ever wonder why.
Well it’s because pigs back then, before any Bible was written, were a hell of a lot dirtier.
Now the Jewish people understood that they get sick if they ate pork, but didn’t really know why (they didn’t know the science behind it).
So they write it down, that it is the will of GOD, that the Jewish people not eat pork.
This is their reasoning that it was inspired by God.
Now using this as an example, you can understand more bizarre logic that is in the Bible.