Biscuts there is a short and long answer to your question. Basically; The short answer is that this won't work. The problem is that the moon (or any other celestial body) doesn't simply move east to west as a result of the Earth's rotation. In the process, it also moves higher (on the way from the eastern horizon to its highest point in the sky,
when it is due south for those of us living in the northern hemisphere) and lower (from its highest point to the western horizon. Therefore, its shadow traces out an arc on the ground, not an east-west line. It would only do that if you lived on the equator, and the moon happened to be on the celestial equator at the time.
The long answer (yes, this one is longer than the "short" answer!) is that there is a way to make it work, utilizing a method employed by the likes of Lewis and Clark (although
they usually used the Sun, for reasons I'll explain later). It's called the equal altitudes method. Here's what you do: 1) Mark the location on the ground of the top of a shadow from a vertical stick when the Sun/Moon when it is not quite due
south (i.e. still rising). Measure the length of the shadow. 2) Wait until the Sun/Moon has passed its highest point (the celestial meridian), when it casts its shortest shadow. 3) Mark another "top of the shadow" spot from the same stick when the shadow length is once again the same as it was in step 1. 4) Draw a line between the first spot and the second spot. This is an east-west line. Now, there are several issues that make this method only marginally useful. 1) Determining the exact top of a shadow is difficult, because shadows cast by non-point sources (like the Sun and Moon) are not sharp-edged--they are fuzzy. 2) The accuracy is greatly dependent on how long before/after meridian transit you begin/end the measurements. If you try to do this
only a few minutes before and after transit, the results can be pretty inaccurate. 3) If you are patient, and start/end well before/after transit, you'll get good results from the Sun, but less so from the Moon. That's because both the Sun and the Moon are constantly drifting either north or south in their
apparent path around the Earth. In the course of a couple of hours, the Sun's north/south drift doesn't amount to much (thus the slow changing of the seasons, a direct result of this drift). But the Moon, which circles the Earth every four
weeks or so, can change its north/south position significantly in the course of a couple of hours. So this method works for making a crude estimate of an east/west line. But why not just find Polaris and know that east and west are exactly ninety degrees to the right/left of due north? For more
precision, drive a couple of sticks in the ground, such that they are both on a line to Polaris. Then construct a perpendicular line to the line connecting the sticks, and
you have an east/west line that's accurate to less than a degree (the distance of Polaris from the true North Celestial Pole). (Incidentally, Lewis and Clark used the equal altitudes method to determine their latitude and longitude, not cardinal directions. For that, they used a compass in the daytime,
and the stars at night.) There was an earlier post about the mathematics of search and rescue, which had similar information.