use these steps.
1 modify init.ora add a line
UTL_FILE_DIR 'D:My_DIR'
2. login as system as sysdba
shutdown immediate;
startup pfile <pfile path> like d:oracleadminorclpfileinit.ora
oracle should startup
create spfile from pfile;
if step 2 is not working then
alter sytem set utl_file_dir 'd:my_dir' scope spfile;
restart the system.
then try your programme.
create folder my_dir in d: drive( os level)
login system as sysdba
create direcotory my_dir as 'd:my_dir';
grant read write on directory my_dir to scott;