Extracting id of cetain group using fix store/state

I have created a sub group and trying to extract atom id using fix store/state and further used loop to extract each id one by one, but in output some of atom id is showing zero. kindly help why some of id are zero. I can dump that group and showing correct atom id without any zero.

---------- Initialize Simulation ---------------------

units metal
dimension 3
boundary p p p
atom_style atomic
atom_modify map array

---------- Create Atoms ---------------------

lattice bcc 2.8553
region box block 0 1 0 1 0 1 units lattice
create_box 1 box

lattice bcc 2.8553 orient x 1 0 0 orient y 0 1 0 orient z 0 0 1
create_atoms 1 box
replicate 3 3 3
mass * 1

---------- Define Interatomic Potential ---------------------

pair_style lj/cut 2.5
pair_coeff * * 1 1

---------- Run Minimization ---------------------

reset_timestep 0
region cod block 0 3 0 3 0 3 units box
group mix region cod
variable total_atom equal count(all)
variable mix_atom equal count(mix)
print ${total_atom}
print ${mix_atom}
dump 15 mix custom 1 dumpcomup.txt id type x y z
run 0
undump 15

fix coord mix store/state 0 id type x y z
label alpha
variable first loop ${mix_atom}
variable id_ext equal f_coord[${first}][1]
print ${id_ext}
variable id_ext delete
next first
jump SELF alpha

output last few line
Total wall time: 0:00:00

This is the expected and documented(!) behavior.
Fix store/state stores per-atom properties that means that is one value for each atom. If you restrict this with a group, then only the values of the atoms in the group are stored, all others are set to zero.
If you re-read the documentation for the fix store/state command — LAMMPS documentation very carefully, you will see that that is what the documentation says. The kind of loop you do cannot work. You have to loop over all atoms and then only print/use the values of those that are not zero.

Thanks for the prompt reply, I got the solution that , I have to loop over all the atom and filter out zeros to extract id of atoms within that group. Do you suggest any other method to extract apart from fix store/state.

I would use a custom dump.