A weak and emaciated Tolkien spent the remainder of the war alternating between hospitals and garrison duties, being deemed medically unfit for general service.  During his recovery in a cottage in Little Haywood, Staffordshire, he began to work on what he called The Book of Lost Tales, beginning with The Fall of Gondolin. Lost Tales represented Tolkien's attempt to create a mythology for England, a project he would abandon without ever completing. Throughout 1917 and 1918 his illness kept recurring, but he had recovered enough to do home service at various camps. It was at this time that Edith bore their first child, John Francis Reuel Tolkien. In a 1941 letter, Tolkien described his son John as "(conceived and carried during the starvation-year of 1917 and the great U-Boat campaign) round about the Battle of Cambrai, when then end of the war seemed as far off as it does now".  Tolkien was promoted to the temporary rank of lieutenant on 6 January 1918. When he was stationed at Kingston upon Hull, he and Edith went walking in the woods at nearby Roos, and Edith began to dance for him in a clearing among the flowering hemlock. After his wife's death in 1971, Tolkien remembered,  I never called Edith Luthien--but she was the source of the story that in time became the chief part of the Silmarillion. It was first conceived in a small woodland glade filled with hemlocks at Roos in Yorkshire (where I was for a brief time in command of an outpost of the Humber Garrison in 1917, and she was able to live with me for a while). In those days her hair was raven, her skin clear, her eyes brighter than you have seen them, and she could sing--and dance. But the story has gone crooked, & I am left, and I cannot plead before the inexorable Mandos.  This incident inspired the account of the meeting of Beren and Luthien.

Answer this question "What else did he do during this time?" by extracting the answer from the text above.
Throughout 1917 and 1918 his illness kept recurring, but he had recovered enough to do home service at various camps.