No. That line does not appear in Shakespeare's Hamlet. The closest thematic passage is Hamlet's "What a piece of work is a man!" speech (Act 2, Scene 2), marveling at human nobility yet calling man "quintessence of dust." The "twice a child" idea (infancy and dotage) comes from Jaques' "Seven Ages of Man" speech in As You Like It (Act 2, Scene 7): "Last scene of all... second childishness and mere oblivion."