The author of the text is very uncomfortable and with a high degree of anxiety at the beginning of the paragraph. He is nervous, feeling bad and feels that he will vomit at any moment. But when he arrives in English class, all these problems go away and he feels comfortable and at home. This is because writing during this class takes away all the bad feelings that come with the author, as if writing cured him of all these ills, his teacher even praises his writing and says he has a future.
With this, we can conclude that the author's goal in writing is to cure.
In My Last Duchess, the painting and the art represent something that is long gone, most noticeably, his love for art. He claims that he once loved art but now that love is gone and he hates it as much as it hates him.