improvise

Definition

To create or perform something on the spot, without prior preparation.

Example

"The actor had to improvise his lines when the script was lost during filming."