Profit maximization and returns to scale relation Suppose we have 2 inputs a and b , output is y=f(a,b).
In the long run, let us suppose profits are maximized at a* and b*.
Profit is py-wa-kb[p is price and w and k are constants]. Now for max profit, profit equals py-wa*-kb*.
Now for constant/increasing returns to scale firms, doubling input clearly doubles or more the profit which means there can be no finite a* and b* for such firms which does not make logical sense to me. 
Where am i wrong?
Are you assuming a perfectly competitive market? If so, then a profit-maximizing firm with constant returns to scale (CRS) production can only feasibly earn zero economic profits as $P = MC$ in the long-run. If not, then either $P &gt; MC$ and the firm continues to produce indefinitely until it hits capacity constraints or $P &lt; MC$ and the firm ceases to operate since producing any units would be unprofitable (in which case doubling inputs would be even more unprofitable).

To see this, it's easiest to consider the firm's cost function $C(w, r, y)$. Since the firm's production is CRS, the firm's average cost of producing $y$ is constant and thus $C(w, r, y) = C(w, r, 1)y$. The firm's unconstrained profit maximization problem is thus

\begin{align*}
\max_{y} \prod = Py - C(w,r,1)y.
\end{align*}

Assuming an interior solution, the first-order condition is

\begin{gather*}
\frac{\partial \Pi}{\partial y} = P - C(w,r,1) = 0 \\
\implies P = C(w,r,1).
\end{gather*}

So at $P = C(w, r, 1)$, profits are zero and output $y$ is indeterminate. If instead $P &gt; C(w,r,1)$, for instance, then we are no longer at an interior solution and it is clear that the firm will continue to produce and use more inputs up until capacity constraints bind.