Answer by taking a quote from the following article:

Ernst Theodor Amadeus Hoffmann (commonly abbreviated as E. T. A. Hoffmann; born Ernst Theodor Wilhelm Hoffmann; 24 January 1776 - 25 June 1822) was a Prussian Romantic author of fantasy and Gothic horror, a jurist, composer, music critic, draftsman and caricaturist. His stories form the basis of Jacques Offenbach's famous opera The Tales of Hoffmann, in which Hoffmann appears (heavily fictionalized) as the hero. He is also the author of the novella The Nutcracker and the Mouse King, on which Pyotr Ilyich Tchaikovsky's ballet The Nutcracker is based. The ballet Coppelia is based on two other stories that Hoffmann wrote, while Schumann's Kreisleriana is based on Hoffmann's character Johannes Kreisler.

The next fifteen months were some of the worst in Hoffmann's life. The city of Berlin was also occupied by Napoleon's troops. Obtaining only meagre allowances, he had frequent recourse to his friends, constantly borrowing money and still going hungry for days at a time; he learned that his daughter had died. Nevertheless, he managed to compose his Six Canticles for a cappella choir: one of his best compositions, which he would later attribute to Kreisler in Lebensansichten des Katers Murr. On 1 September 1808 he arrived with his wife in Bamberg, where he began a job as theatre manager. The director, Count Soden, left almost immediately for Wurzburg, leaving a man named Heinrich Cuno in charge. Hoffmann was unable to improve standards of performance, and his efforts caused intrigues against him which resulted in him losing his job to Cuno. He began work as music critic for the Allgemeine musikalische Zeitung, a newspaper in Leipzig, and his articles on Beethoven were especially well received, and highly regarded by the composer himself. It was in its pages that the "Kapellmeister Johannes Kreisler" character made his first appearance. Hoffmann's breakthrough came in 1809, with the publication of Ritter Gluck, a story about a man who meets, or believes he has met, the composer Christoph Willibald Gluck (1714-87) more than twenty years after the latter's death. The theme alludes to the work of Jean Paul, who invented the term Doppelganger the previous decade, and continued to exact a powerful influence over Hoffmann, becoming one of his earliest admirers. With this publication, Hoffmann began to use the pseudonym E. T. A. Hoffmann, telling people that the "A" stood for Amadeus, in homage to the composer Wolfgang Amadeus Mozart (1756-91). However, he continued to use Wilhelm in official documents throughout his life, and the initials E. T. W. also appear on his gravestone. The next year, he was employed at the Bamberg Theatre as stagehand, decorator, and playwright, while also giving private music lessons. He became so enamored of a young singing student, Julia Marc, that his feelings were obvious whenever they were together, and Julia's mother quickly found her a more suitable match. When Joseph Seconda offered Hoffmann a position as musical director for his opera company (then performing in Dresden), he accepted, leaving on 21 April 1813.

what did he do during this time?
he managed to compose his Six Canticles for a cappella choir: