Getting “Can’t find variable: Highcharts” error when injecting highchart html & JS inside iframe using javascript

Getting Can’t find variable: Highcharts” when I am injecting highchart js in iframe.

Requirement –
I need to create dynamic highchart boxes where we I can copy html/js/css content from high chart fiddle (as given in the highchart reference below) and can paste it in our application textareas (input for html/css/js).

Expected behavior – highchart should be visible in the iframe.

Test where I am getting error
“https://jsfiddle.net/6hwmx2ej/19/”

highchart reference
“https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/line-basic”