Gross domestic product (GDP) increased by 0.4% in July, following growth of 0.3% in June, official figures showed.