The short answer to the question of why William Carlos Williams wrote the short story "The Use of Force" is that we don't actually know and it doesn't really matter. Not only is it not possible to read the mind of someone who died over 50 years ago, but we don't actually need to know why he wrote the story to enjoy it and learn from it.
We do know that Williams was a country doctor, and did do home visits to families during diphtheria outbreaks; thus it's probable that the story distills some of his actual experiences in dealing with recalcitrant children in such circumstances.
What makes the story one worth telling and reading is the way it illuminates, in a very short and concrete compass, a moral dilemma encountered by doctors specifically but also by parents: the need to hurt a child in order to help her. Once the narrator makes the decision, "Then the battle began. I had to do it. I had to have a throat culture for her own protection."
While the decision concerning the necessity of a throat culture was a rational one, the most gripping part of the story is the psychological portrayal of the narrator, and the mechanism by which once he starts using force, he becomes brutalized by his own actions:
I have seen at least two children lying dead in bed of neglect in such cases, and feeling that I must get a diagnosis now or never I went at it again. But the worst of it was that I too had got beyond reason. I could have torn the child apart in my own fury and enjoyed it. It was a pleasure to attack her. My face was burning with it.
Although we cannot know for certain the motive Williams has in writing this story, it may well have originated in his "feeling of adult shame," and desire to understand his own emotions as a doctor in such circumstances.