Relation between quantum probe and entanglement in n-qubit systems within Markovian and non-Markovian environments