If you can generate a small reproducer you can post it here; you can make a small github repository,
there are web sites where you can post data; ideally you could place it on the godbolt site as runnable source and save and share it.
This is a small program that arbitrarily has lines composed of ten integers, but that could be anything.
After creating the dummy file, ALL the contents of line 5 are read back; a value read back is changed, and then the line is written back.
The line chosen is displayed before and after the rewrite to show the third integer value was changed.
As @RonShepard emphasized, you read and write a LINE of a direct access file.
There are tricks you can play to make the file word-addressable if all the values are of the same intrinsic type, where you close and reopen the file with recl= the size needed for one value, but that is a very special case.
There are other tricks to play with direct access, but sticking to the basic generally intended use hopefully the example will clarify where you went wrong. Note you can make a seekable file in Fortran now as well, but that is a very different approach.
program direct_access_example
! + Write arbitrary dummy direct access file, 10 integer numbers per line
! + Read the ENIIRE 5th record and change one of the values read back
t! + write the ENTIRE line back into the file
implicit none
integer :: i, j, rec_num, unit, iolength, line(10)
character(len=*),parameter :: all='(*(g0,1x))'
inquire(iolength=iolength) line ! going to arbitrarily write 10 integers to a line
write(*,*)'IOLENGTH=',iolength
! Open the file with direct access: fixed-length records
open(newunit=unit, file='direct.dat', access='direct', form='unformatted', &
recl=iolength, status='replace')
! create dummy file
do i = 1, 100
write(unit, rec=i) ( (i-1)*10+j,j=0,9 )
enddo
! show line five
rec_num=5
call showrec_num()
! change third value of line five and rewrite line
read(unit, rec=rec_num) line ! note we read ALL of line five
line(3)=-1-huge(0) ! change a value from what we read back
write(unit, rec=rec_num) line ! write the unchanged and changed values, replacing the entire line
call showrec_num() ! show the changed line
close(unit, status='delete') ! Close the file
contains
subroutine showrec_num()
! Read and display record REC_NUM from the file
read(unit, rec=rec_num) line
print all, 'Values in record', rec_num, 'is', line
end subroutine showrec_num
end program direct_access_example
Your file is all real values, presumably of the same size. In general I would recommend the method above, but it sounds like your file is that special case where you could open with a record length of a single value, thus creating a file where each line is a single value. This enables you to change any single value individually, but if you go down that path make sure you extensively document you are using the file with a record length different than what the file was created with or you might end of confusing people. It can be a handy trick but use it sparingly if you do.