Q:

What are the applications of primitive recursive functions?

So I was studying primitive recursive functions and I thought what could be their possible. Is the property of not having infinite loops used somewhere? Because since they do not represent the set of all computable problems,what is their use exactly?

A:

The thing that is actually important is being a total computable function, which is to say that there is an algorithm that can compute any value of the function in finite time.
The primitive recursive function are an important, but proper, subset of the total computable functions. Some reasons for this include:

It is relatively easy to convince oneself that every primitive recursive function is total computable, even if you're being skeptical about high-powered proof methods that may be needed to prove other algorithms total (such as inifinitary set theory).
It is easy to prove things about the primitive recursive functions, because their definition gives rise to a structural induction principle.
Most functions that we need to consider in computability theory, proof theory, etc. are in fact primitive recursive, which means that we don't need to go beyond primitive recursion and look for proof techniques that work for more general total computable functions.

