From a biological point of view, flapping wings is a viable means of flight. However, this presents some problems when scaled up for human flight.
One issue is the square-cube law: as the wings are scaled up, the area scales as a square (relating to lift), but the volume scales as a cube (relating to weight). This means the wings increase in weight faster than they increase in lift, resulting in less effective wings. The higher weight presents issues in making them flap.
ratchet freak pointed out that we do have such machines, and they are called ornithopters. Although there is some potential at smaller sizes (for small UAV's), the weight and force issue prevents them from being very useful at larger scales. Ornithopters were some of the first unsuccessful designs for heavier than air flight.
The best solution we have found is propellers. This doesn't work as well as biological propulsion, but it's much easier to spin a prop than flap the whole wing, and works much better for the larger scales we need to move humans. Flapping is also not effective for reaching higher speeds.
You can also see from the biological side that there is a size limitation. The largest birds are much smaller than our airplanes.