Why was the price of gold lower when gold confiscation act was issued but raised afterwards? I was reading up on the gold reserve act which made it illegal for US citizens to own gold with some minor exceptions.

According to the gold confiscation act which was issued before the gold reserve act the government paid 20.67$ per troy ounce.


  Executive Order 6102 required all persons to deliver on or before May 1, 1933, all but a small amount of gold coin, gold bullion, and gold certificates owned by them to the Federal Reserve, in exchange for 20.67\$ (equivalent to $408 in 2019)[5] per troy ounce. 


However shortly afterwards the government raised the price for gold to 35$ an ounce.


  The price of gold from the Treasury for international transactions was then raised by the Gold Reserve Act to \$35 an ounce (equivalent to $691 in 2019)[5]. The resulting profit that the government realized funded the Exchange Stabilization Fund established by the Gold Reserve Act in 1934. 



The reason gold was confiscated was to end deflationary tendencies . But why does the government raise the price of gold AFTER the confiscation? Wouldn't the effect on deflation be the same if they fixed the price of gold at 35$ in the beginning?
It is stated that the governement used the profit to fund the Exchange Stabilization Fund Is this the only reason the government set the price of gold AFTER all the gold has been collected?
Answer to Q1:

Wouldn't the effect on deflation be the same if they fixed the price of gold at 35$ in the beginning?

Yes it should. The value of currency under gold standard is given by the price of gold so if one ounce of gold is set to be worth $\\\$100$ then $\\\$1$ will be worth $1/100$ ounce of gold. If government would set the price for gold to $\\\$200$ per one ounce then the value of $\\\$1$ would be only $1/200$. Hence increasing the price at which dollar exchanges for given amount gold is inflationary under the gold standard.
The rationale for confiscating gold is actually already hinted at on that Wikipedia page:

The main rationale behind the order was actually to remove the constraint on the Federal Reserve preventing it from increasing the money supply during the depression. The Federal Reserve Act (1913) required 40% gold backing of Federal Reserve Notes that were issued. By the late 1920s, the Federal Reserve had almost hit the limit of allowable credit, in the form of Federal Reserve demand notes, which could be backed by the gold in its possession.

Wikipedia does not mention source for this statement,  but it is a statement that you will find across literature (see below). Furthermore,  Wikipedia is not clear about this but the reason why Fed was running out of gold reserve was that people expected that there will be devaluation of dollar so people wanted to earn profit by first converting dollar for gold at the Fed at the old price $\\\$20.67$, then wait for the devaluation of dollar to happen and then convert gold back to dollars at higher price (they could not know exactly what the higher price will be but it was reasonably expected that there will have to be some devaluation to combat deflationary pressures).
For example, according to Bordo 1989:

that rumors of devaluation appearing weeks before the banking holiday-events such as bills in Congress proposing to devalue the dollar,
statements by leading financial figures, and FDR’s unwillingness to
commit himself to the current exchange rate-triggered the run on the
dollar. The run manifested itself in both an internal and foreign demand
for gold by individuals and central banks. l9 Furthermore, he argues
that though the increase in currency was three times the amount of
gold reserves lost by the New York Fed, the fact that gold losses
threatened to reduce the Fed’s reserves below the legal limit-while
at the same time it had a virtually unlimited ability to meet demands
for domestic currency-was crucial.
Wigmore also attributes the calm which immediately followed the
banking holiday to the Roosevelt administration’s international policies: the embargo on gold ownership and export, and restrictions on
foreign exchange dealings. The former cut off the domestic channels
for a speculative run on the dollar, and the 60 percent devaluation of
the dollar in the ensuing three months removed the source of the speculative pressure

Answer to Q2:

It is stated that the governement used the profit to fund the Exchange Stabilization Fund Is this the only reason the government set the price of gold AFTER all the gold has been collected?

Well we can only make conjectures about what was going on in the heads of government officials at the unprecedented times of Great Depression, but I would guess their main objective was to prevent the speculative run on and  fall of gold reserves. Getting funds for the program was probably secondary issue. There might have been further non-economic reasons (e.g. political reasons).