Here is the monthly pattern of the Sun and the Moon, rising in the east and setting in the west. Sometimes the Moon moves with the Sun, but at other times it lies far from the Sun (on the other side of the Earth from the Sun).

The Sun lies above the horizon for roughly twelve hours each day, and below
the horizon for roughly twelve hours each night. It rises, spends six hours
climbing through the sky, transits, and then wafts its way downward for
another six hours.
The Moon follows a similar pattern, but it can lie above (or below) the horizon during either the night or the day, depending on its phase (depending how far it lies from the Sun in the sky).