Cannibalistic zombies have overrun the entire world. The remaining fragments of the U.S. government and military hide out in fortified military bases and colonies, attempting to find a solution to the zombie pandemic. Sarah, Private Miguel Salazar, radio operator William "Bill" McDermott, and helicopter pilot John fly from their base to Fort Myers, Florida, in an attempt to locate additional survivors. They encounter a large horde of the undead, and return to their army base in the Everglades, where a small group of scientists, supported by a skeleton crew of soldiers, is searching for a way to stop or reverse the re-animation process.
Dr. Logan, the lead scientist – also known as "Frankenstein" due to his grisly surgical dissections of zombies  – believes that the zombies can be trained to become docile, and accordingly has amassed a collection of test subjects, which are kept in a large underground corral in the compound, in spite of the objections of base-commander Captain Henry Rhodes. The tension between soldiers and scientists worsens in the face of dwindling supplies, loss of communication with other survivors, and slow progress in research. During a meeting between the scientists and the soldiers, Rhodes announces that he is taking command of the base, that the scientists henceforth will work under his orders, and that anyone who objects will be instantly killed. Dr. Logan hopes to secure Rhodes' cooperation by showing him the results of his research. He is especially proud of "Bub", a docile zombie who remembers some parts of his past life and engages in rudimentary human behavior: listening to music, aiming a pistol, and saluting Captain Rhodes. "Civil behavior must be rewarded," Logan says. "If it's not rewarded, there's no use for it. There's just no use for it at all!" Rhodes is not impressed.
During a zombie roundup mission, two of the soldiers, Miller and Johnson, are killed after a zombie escapes its harness; whereupon Miguel attempts to kill the creature, but is bitten on the arm. Sarah amputates the arm and cauterizes it to stop the spreading infection. Rhodes then calls off the experiments and demands that all captive zombies be destroyed. Sarah and Bill later discover a crude form of Dr. Logan's experimentation involving the bodies of Miller and Johnson and an audio tape in which a crazed Logan talks to his "Father" and "Mother"; horrified, both Sarah and Bill plan to leave in the helicopter immediately before someone else does.
Conditions worsen when Rhodes finds out that Logan has been feeding the flesh of his dead soldiers to Bub as a reward for his docility and positive behavior. Enraged, Rhodes kills Logan and his assistant Dr. Fisher. He then locks Sarah and Bill inside the zombie corral and then attempts to force John to fly him and his men away from the base, which John refuses to do.
Bub manages to escape from his chain and finds Dr. Logan's corpse. In a display of human emotion, he expresses sadness and then becomes enraged. He finds a pistol discarded on the floor and goes in search of revenge. Meanwhile, Miguel, who has become suicidal, opens the gates to the compound, allowing the horde of zombies lurking outside to enter onto the elevator, devouring him. While Miguel is doing this, John overcomes his captors, knocking both Rhodes and Torrez out before stealing their weapons and going into the zombie corral to rescue Sarah and Bill. The zombies rapidly enter the complex; Pvt Rickles and Pvt Torrez are torn apart by the horde. Pvt Steele attempts to shoot Bub through a covered window, but gets bitten by another zombie and chooses to kill himself. Rhodes attempts to escape, but is shot and wounded by Bub and violently torn to pieces by a crowd of zombies.
John reunites with Sarah and McDermott inside the zombie corral. They escape together to the surface, board the helicopter, and fly to a deserted island with no dead people or zombies on it. The film ends with Sarah crossing off a day on her calendar which counts the days since their escape from the compound.

Question: Why was Logan feeding the flesh of a dead solider to Bub?
Answer: Logan was rewarding Bub for docility and positive behavior.
Alternative answer: As a reward for docility and good behavior