How to copy a face at same the location?(Ruby code)

I want copy a face at the same location with selected face

This would be counterproductive, because the new face would overlay the existing face exactly and thereby it’d overwrite it, then you’d be no further forward !
BUT if you want to copy a face into another context - e.g. a group.entities - then you need to get all of its data and ‘reproduce’ it…

How are you getting a reference to this face ?
If it’s selected in the active_entities context then first get the tag of the face and its edges etc.
Now temporarily group it - temp_group.
Next make a new empty_group in the same active_entities and add an instance of that temp_group to the empty_group.entities, explode the original temp_group [reverting its contents to the original tag] and the original face is ‘reverted’ [reset its geometry’ tags as saved earlier].
Now explode the group you added within your empty_group, again reset its geometry’ tags as saved earlier.

Now you have a copy of the face with its materials, tags etc but within a new group.

If the face is within another context you can replicate it, but again you need to save its various attributes and assignments, because you cannot ‘cross-thread’ entities in the API.
So make a ‘data-base’ of the face and its edges/loops and replicate it in the new context - e.g. a group - making sure that everything you’ve collected about the face are carried over…
Typically these will be the vertices [points] of the face outer- and inner-loops, all of its edges properties including tag [layer], material, attribute-dictionaries and their key/value pairs.
The face itself with have the aforementioned vertices and its normal to replicate, and its front and back materials, with any UV manipulation of textures etc, and of course the face’s attribute-dictionaries and their key/value pairs.
When the geometry is recreated and the various assignments and attributes copied over you also need to consider the ‘transformation’ of the original face’s ‘container’ - so for example was it a scaled or rotated group/instance etc, or itself nested… if so you need to apply an inverse transformation to your new geometry so that it appears the same as it did originally…