Here is a beam with an imprinted orange face that doesn't touch any other face or edge.
This is usually unnecessary. The warning messages are very conservative and can often be ignored.

You don't need apdl to create a spring with those properties. You can do that in Mechanical.

If the two faces on the two bodies are 12 mm apart, then the spring will be that long automatically. If the faces are not 12 mm apart, you can move either the Mobile or the Reference Coordinate (X, Y, or Z) to a location to achieve the spring length you want.

If you have an answer to your question, please mark a post with Is Solution to mark the discussion as Solved, or ask a followup question.