Eating poo is not uncommon and no one has discovered a fool-proof answer to this problem.
Dogs may have different reasons for starting to eat their poo and things that will work in one set of circumstances may not in others.
There are products on the market that will help some dogs and may be worth a try. The use of pineapple in the food is supposed to make the faeces taste horrible and may break the habit.
The most likely reason is that some dogs do not completely digest their food and there is some nutritional value (especially in puppy foods when this is often learned) remaining in the waste product. It therefore seems reasonable to your dog to re-eat it. This is normal behaviour for many canid species who are essentially scavengers. With other dogs it has just become a habit or a relief of boredom.
When you are with your dog, it is relatively easy to pick up immediately after they have performed, although there is the danger of drawing attention to the behaviour if you make too much fuss. Competing with them for her faeces is not to be encouraged, so try to be discreet. You either need to be outside with them or else use a Baskerville muzzle to try to break the habit.
If the main problem is at night, you obviously have a house-training problem. An adult dog should be able to go through the night without having to relieve himself. It may be that the food, while perfectly satisfactory for most dogs, is not suitable and it might be worth experimenting with one that produces a smaller, more easily held stool. It might also be worth experimenting with feeding times - earlier or later - to see if that helps them to hold out until they can go outside. Dogs confined to a smaller area, such as an indoor kennel, are less likely to foul the space near their beds, so this might be worth a try.
You should also make sure that all your worming is up to date to help reduce cross-contamination of parasites.