Read PWM duty from a pin and write PWM to a pin

It reads analog Duty cycle as I can see on a serial monitor. Problem is with output duty cycle generation. But I think I have found solution for the problem.