Its possible in a 100% efficient system, how ever in reality, there would be heat losses in between the motor and the dynamo which would reduce the energy given to the dynamo eventually
If in the first step the motor gives 100J to the dynamo , in the second step the energy given would be 90J...