Is it possible to imitate two way communication between a brain and a limb? Human muscles are controlled by action potentials that travel along the nerves. Below is an image of a train of action potentials that are decoded by the brain into a sensation or interpreted by a muscle group as a command.

I'm interested if it is possible to record such action potential sequence and then "play it back" for that person. For example, a person is moving a leg, a recording of action potentials is made. Can such recording be transferred back to the nerves to create an illusion of movement or repeat the muscle movement?
Short answer
Mimicking action potentials is possible, but not the most practical approach.

Background
In general, stimulation of neural tissues occurs through placing electrodes in the vicinity of the target tissue and applying short current pulses, e.g. think cardiac pace makers, cochlear implants, retinal implants (Rao &amp; Chiao, 2015), as well as muscle stimulators. 

Long-term electrical stimulation of tissues in humans are accomplished by means of biphasic pulses, such that one phase reverses the current injected by the other. Such alternative current stimuli are called charge-balanced pulses, and are used because direct current (DC) stimulation may damage neural tissues (Bahmer &amp; Baumann, 2013). In animals and short-term applications other asymmetric and unbalanced pulse shapes may be applied. 

Secondly, external electrical stimuli induce electric fields such that neurons are depolarized and start firing their own action potentials. Mimicking action potentials doesn't make much sense therefore. It is a more straightforward approach to activate the system externally and let things develop physiologically thereafter to maintain normal neuronal processing. 

But of course, in the end you could stick a needle electrode inside neurons and attempt to mimic the voltage changes over time like that in an action potential train, for example through the application of voltage clamp techniques. Nonetheless, I would rather stick to state-of-the-art applications and apply external biphasic pulse trains and leave the details to the neuronal tissue.  

References
- Bahmer &amp; Baumann, Hear Res (2013); 306:123-30
- Rao &amp; Chiao, IEEE Microwave Magazine (2015); 16(2): 54-64