Parts of the Luger are from Erfurt (extractor and magazine release) and the maker's marking on the forward toggle seems to have been scrubbed off. A good photo of the left side and the serial number on the front of the frame would help to determine the maker.
The unit marking on the grip strap, "174.R.M.G.54." indicates that it was the 54th weapon issued to the Machine Gun Company of Infantry Regiment 174. It would have been issued to an enlisted man.
Infantry Regiment 174 title was 10.Lothringisches Infanteri-Regiment they were garrisoned in Metz from 1905-1913 and in Lahr in 1914. It was part of the XXI. Army Corps. Upon mobilization in 1914 the 174th was assigned to the 31st Infantry Division and remained with that division throughout the war.
In 1914 the 31st was in Lorraine and then the Somme. In 1915 the division was transferred to the Hindenburg Army in East Prussia.
They suffered heavy losses to a Russian offensive in Grodno before transferring to the Vilna area in August.
In December 1917 the 31st Division was transferred to Ghent in Belgium
April 1918 it took part in the Battle of Ypres where the third Battalion of the 174th IR suffered 70% losses. In May the division suffered heavy losses of prisoners in a French attack on the 21st.
September - November the 31st fought American troops in the Battle of St. Mihiel and later at the Meuse-Argonne.