Yeah it's a very naive question, but just would like to get a clear understanding.
From what I believe the producer has a desire for an idea to become a fun, the director shapes that idea with his vision, and the writer takes that vision and makes a script with some of his thoughts. And sometimes one person has 2 or all the roles.