First make a command block
set the command block to repeat and always active
type the following command:
tp @e[type=fireball] ~~2~
place a structure block on top of the command block
spawn a ghast
go in survival mode
get the ghast to shoot a fireball at you
go in creative mode
save the fireball in the structure block as entity:fireball
place another command block and set it to repeat and always active
now type this command:
execute @e[type=snowball] ~~~ structure load "entity:fireball" ~~~
destroy the command that teleports the fireball above it
and enjoy shooting fireballs