Matlab digital phase locked loop script
This is actually an answer to this comment. It may solve your original problem also.

At the moment I am facing problems with tuning VCO to 10KHz in the code. Currently in the above code VCO is tuned to 0.01Hz. When I change this value to 10KHz, I am not getting pure sine and cosine at the output of VCO. Once this is sorted, I will redesign the filter.

Your code is
for i=1:4000
y = cos(2*pi*0.0099999*i+pi/2.345543);

i seems to be the time variable.
Guessing the units from the above code \$\sin(\omega_{rad/s}\cdot t_{second})\$, the units of the time variable i is seconds. The system is effectively being simulated with a sampling period of 1 second since i=1,2,3,4,....
By sampling theorem, the above sampling frequency is too low. The time variable should increment by a value (much) smaller than \$\frac{1}{2*10k}=50\mu s\$.
Try modifying your code to look something like
ts = 1e-6; % ts has units of seconds
t = 0 : ts : 10  % t has units of seconds
n = length(t);

for sample_number = 1 : n
  current_time = t(sample_number);
  my_sine_signal_value = sin(2*pi*fhz*current_time + phase_offset_rad)
  %% other processing code
end

plot(t, whatever_signals_you_want_to_plot);