why mass of mg is determined indirectly by measuring its length instead of passing by balance?

Your question as posted makes no sense, at least to me. Perhaps you could rephrase it.