The plugin generated xxx characters of unexpected output during activation

Anything outside the <?php ?> tags will be echoed as output since it has no conditions.

The fastest way is to wrap in a function and output in the footer.

add_action('wp_footer','custom_random_script');
function custom_random_script() {
    echo '<script>
    ......SCRIPT CONTENTS......
    </script>';
}

There is nothing technically wrong with outputting the script inside your existing function either, it will still work.

function GenCoupon(){
    echo "<input type = \"button\" onclick = \"randomCoupGen()\">Click here to see if you won!!</input>";
    echo '<script>......SCRIPT CONTENTS......</script>';
}

Or put the script in a separate file and use wp_enqueue_script.